共用方式為


Journal Queues

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Queue and computer journals are system queues that are automatically created by Message Queuing. The following illustration shows a destination queue and its queue journal, as well as several computers with their computer journals. When the sending application sends a message, a copy of the message is optionally stored in the computer journal of each computer through which it passes. When the receiving application removes the message from the destination queue, a copy of the message is optionally sent to the queue journal.

<No Change>

Applications can only read the messages in queue and computer journals. They cannot send messages to queue or computer journals. In contrast, Message Queuing never removes messages from queue or computer journals. It is up to the application reading the messages to clear the messages from the journals. If an application uses journaling and no provisions are made to clean up the journals used, the storage available to Message Queuing will be depleted.

Queue Journals

Queue journals are created whenever an application queue is created. They are used to store copies of all messages removed from the queue. Message queuing creates the queue journal on the same computer where the messages for the application queue are stored.

Message Queuing stores copies of the messages removed from the application queue whenever target journaling is enabled on the queue. To enable target journaling, the journaling level of the queue (PROPID_Q_JOURNALor MSMQQueueInfo.Journal) must be set to MQ_JOURNAL.

Note

This does not include messages removed from the queue when their time-to-be-received timer expires, or messages purged from the queue by users in an MMC snap-in.

Journal queues can be referenced by a public format name, a private format name, or a direct format name. The following lines show the syntax of these format names:

PUBLIC=QueueGUID;JOURNAL  (For public queue journals)  
PRIVATE=ComputerGUID\QueueNumber;JOURNAL  (Private queue journals)  
DIRECT=AddressSpecification\QueueName;JOURNAL  (For public queue journal)  
DIRECT=AddressSpecification\PRIVATE$\QueueName;JOURNAL  (For private queue journals)  

The following lines of code are examples of queue journal format name strings (note that the format name strings are null-terminated Unicode strings).

LPWSTR wsz = L"PUBLIC=308FB580-1EB2-11CA-923B-08002B1075A7;JOURNAL";  
LPWSTR wsz = L"PRIVATE=AE0C5671-F190-12CE-AE10-00DD0114290F\0000000D;JOURNAL";  
LPWSTR wsz = L"DIRECT=OS:Mike01\MyQueue;JOURNAL";  
LPWSTR wsz = L"DIRECT=OS:Mike01\PRIVATE$\MyPrivateQueue;JOURNAL";  

To enable journaling on a queue using the Message Queuing MMC snap-in:

  1. Open the Control Panel.

  2. Open the Administrative Tools applet.

  3. Open the Computer Management applet.

  4. Expand the Services and Applications node.

  5. Expand the Message Queuing node.

  6. Browse to your queue, right-click it, and select Properties.

  7. In the General tab, find the Journal group box at the bottom and check the Enabled checkbox.

Computer Journals

A computer journal is created whenever a Message Queuing computer is added to the enterprise. It is used to store copies of messages successfully sent from the computer.

Message Queuing stores copies of the messages sent from the computer whenever positive_source journaling is specified by the sending application. Source journaling is used to track messages as they are routed to the target computer where the messages for the destination queue are stored. To enable positive source journaling, the journaling level of the message (PROPID_M_JOURNAL or MSMQMessage.Journal) must be set to MQMSG_JOURNAL when the message is sent.

Computer journals can be referenced by a machine format name or a direct format name. The following lines show the syntax of these format names:

MACHINE=ComputerGUID;JOURNAL  
DIRECT=AddressSpecification\SYSTEM$;JOURNAL  (Introduced in MSMQ 2.0)   

The following lines of code are examples of computer journal format name strings (note that the format name strings are null-terminated Unicode strings).

LPWSTR wsz = L"MACHINE=308FB580-1EB2-11CA-923B-08002B1075A7;JOURNAL";  
LPWSTR wsz = L"DIRECT=OS:Mike01\SYSTEM$;JOURNAL";  
For information on See
Using target journaling Target Journaling
Enabling positive source journaling Source Journaling
Code examples for requesting positive source journaling Target and Source Journaling Examples
Other system queues System-Generated Queues
The elements and syntax of machine format names Machine and Connector Format Names
The elements and syntax of direct format names Direct Format Names