The Journal property is used for queues (MSMQQueueInfo object) and messages (MSMQMessage object).
For a queue, Journal specifies whether or not messages retrieved from the queue are stored in a queue journal.
For a 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 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, 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 machine, 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, and then 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, 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, and then 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
Body, Create, FormatName, JournalQuota, Label, MSMQQueueInfo, PathName, Refresh, Send, Update