The Journal property is used for queues (MSMQQueueInfo objects) and non-transaction messages (MSMQMessage objects).
For a queue, Journal specifies whether or not messages retrieved from the queue are stored in a queue journal.
For a non-transaction message, Journal specifies whether a copy of the message is sent to a machine journal when the message is sent, to a dead letter queue if the message could not be sent, or neither.
Type: | Long |
Run time: | read/write |
object.Journal
Syntax Element | Description |
---|---|
object | Queue information (MSMQQueueInfo) object used to define a queue, or message (MSMQMessage) object used to define a message. |
For queues, set Journal to one of the following values:
For non-transaction messages, set Journal to one or more of the following values:
Journal does not create a queue. Journal, machine, and dead letter queues are all system queues generated by MSMQ. For more information about types of queues, see Journal Queues and Dead Letter Queues. For an example of reading messages from a journal queue or dead letter queue, see Reading Messages In a Queue.
To reset Journal, set Journal to a new value and, if the queue is open, call the MSMQQueueInfo object's Update method. If the queue is not open, do not call Update because the queue's properties are updated automatically when the queue is opened.
To find out if a queue is using a journal queue, call the MSMQQueueInfo object's Refresh method.
The size of the queue's journal queue can be set using the JournalQuota property.
This example creates a private queue on the local computer, attaching a journal queue to the created queue. To try this example using Microsoft® Visual Basic® (version 5.0), paste the code into the Code window of a form, run the example, and click the form.
Dim qinfo As MSMQQueueInfo
Private Sub Form_Click()
Set qinfo = New MSMQQueueInfo
qinfo.PathName = ".\PRIVATE$\JournalTest"
qinfo.Label = "Test Queue"
qinfo.Journal = MQ_JOURNAL
qinfo.Create
MsgBox "Queue's Format name is: " + qinfo.FormatName
End Sub
This example first creates and opens a queue for sending messages, and then sets the delivery mechanism for a message and sends it off to the queue.
To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, run the example, and click the form.
Dim msgMessage as New MSMQMessage
If qFriendQueue.IsOpen Then
msgMessage.Journal = MQMSG_JOURNAL 'Specify machine journal.
msgMessage.Body = Chr(KeyAscii) 'Fills message Body.
msgMessage.Label = "myMessage" 'Sets message label.
msgMessage.Send qFriendQueue 'Sends message.
End If
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.
Body, Create, FormatName, JournalQuota, Label, MSMQQueueInfo, PathName, Refresh, Send, Update