共用方式為


PROPID_Q_JOURNAL

 

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

The PROPID_Q_JOURNAL property specifies how Message Queuing tracks messages removed from the queue.

Property ID

PROPID_Q_JOURNAL

Type Indicator

VT_UI1

MQPROPVARIANT Field

bVal

Property Value

This property can be set to one of the following values:

MQ_JOURNAL

Target journaling is requested. Copies of messages are stored in the journal of the queue whenever a receiving application removes a message.

MQ_JOURNAL_NONE

The default. Target journaling is not requested. Messages removed from the destination queue are no longer available.

Remarks

When PROPID_Q_JOURNAL is set to MQ_JOURNAL, Message Queuing stores a copy of each message removed from the queue in the journal of the queue. For information on tracking messages that are removed from the queue, see Target Journaling.

Queue journals are not created when target journaling is requested. Queue journals are created automatically by Message Queuing when the destination queue is created. However, applications can set the maximum size of the queue journal by setting the PROPID_Q_JOURNAL_QUOTA property of the destination queue.

Periodically clear messages from the queue journal to remove messages that are no longer needed. Messages stored in the queue journal count against the quota of the journal and the quota of the computer where the queue journal resides (the computer quota is set by the administrator). Processing the messages in queue journals is the responsibility of the application or the Message Queuing administrator. Messages should be removed from these queues on a regular basis so that they do not consume the resources of the computer. If the journal or computer quota is exceeded, Message Queuing will not send copies of the messages to the journal when the messages are received.

To set target journaling when creating a queue, include PROPID_Q_JOURNAL in the MQQUEUEPROPS structure and call the MQCreateQueue function.

To reset the journaling level, specify PROPID_Q_JOURNAL in the MQQUEUEPROPS structure and call MQSetQueueProperties. Resetting this property has no effect on messages already removed from the queue.

To retrieve the journaling level of the queue, specify PROPID_Q_JOURNAL in the MQQUEUEPROPS structure, and then call the MQGetQueueProperties function and examine its returned value.

When retrieving the journaling level, the type indicator can be set to VT_UI1 or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI1 during the function call.

Equivalent COM Property

When using COM components, the journaling level of the queue can be set and retrieved using the MSMQQueueInfo.Journal property.

Example Code

The following code fragments show how PROPID_Q_JOURNAL is specified in arrays that can be used to initialize an MQQUEUEPROPS structure when setting (or resetting) and retrieving the journaling level of the queue.

To Set or Reset the Journaling Level

aQueuePropID[i] = PROPID_Q_JOURNAL;          // Property identifier  
aQueuePropVar[i].vt = VT_UI1;                // Type indicator  
aQueuePropVar[i].bVal = MQ_JOURNAL;          // Queue journal is used  
i++;  

To Retrieve the Journaling Level

aQueuePropID[i] = PROPID_Q_JOURNAL;          // Property identifier  
aQueuePropVar[i].vt = VT_NULL;               // Type indicator  
i++;  

The following examples are included in Using Message Queuing.

For an example of See
Setting the journaling level of an existing queue C/C++ Code Example: Setting PROPID_Q_JOURNAL
Retrieving the journaling level of an existing queue C/C++ Code Example: Retrieving PROPID_Q_JOURNAL

See Also

Queue Properties
MQCreateQueue
MQGetQueueProperties
MQQUEUEPROPS
MQSetQueueProperties
PROPID_Q_JOURNAL_QUOTA