Journal
MSMQQueueInfo MSMQMessage

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.

Quick Info

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 messages, set Journal to one or more of the following values:

MQMSG_DEADLETTER
If the message time-to-be-received or time-to-reach-queue setting expires, keep the message in the dead letter queue on the machine where time expired.
MQMSG_JOURNAL
If the message is transmitted (from the originating machine 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 machine'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, 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.


Machine Journal
MSMQ automatically sends transactional messages to the transaction dead letter queue (DEADXACT) on the source machine if the message is not delivered. For information on transactions, see MSMQ Transactions.

Example: Specifying a queue journal

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
 

Example: Specifying a machine journal

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
 

See Also

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


© 1997 by Microsoft Corporation. All rights reserved.