Journal
MSMQQueueInfo    MSMQMessage

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

Syntax

object.Journal
 
Syntax Element Description
object Queue information (MSMQQueueInfo) object used to define a queue, or message (MSMQMessage) object used to define a message.

Settings

For queues, set Journal to one of the following values:

MQ_JOURNAL
When a message is removed from the queue, it is stored in the queue journal.
MQ_JOURNAL_NONE
The default. Messages are not stored in a journal queue when they are removed from the queue.

For non-transaction messages, set Journal to one or more of the following values:

MQMSG_DEADLETTER
If the non-transaction message is not delivered to the receiving application (for example, a message timer expired or an incorrect destination queue was specified), the message is sent to a dead letter queue on the computer where the message is located.
MQMSG_JOURNAL
If the message is transmitted (from the originating computer to the next hop), keep it in the machine journal on the originating machine.
MQMSG_JOURNAL_NONE
The default. The message is not kept in the originating computer's machine journal.

Remarks

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.

Queue Journal
To specify a journal queue, set Journal to MQ_JOURNAL and call the MSMQQueueInfo object's Create method.

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.

Example: Specifying a queue journal

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
 

Example: Specifying a machine journal

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
 

QuickInfo

  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.

See Also

Body, Create, FormatName, JournalQuota, Label, MSMQQueueInfo, PathName, Refresh, Send, Update