Udostępnij za pośrednictwem


Message Queue Journal Storage

Journal queues allow you to save copies of messages as they are processed. You can store copies of the messages you send from your computer in the local machine journal queue, or you can store copies of messages removed from a queue in that queue's journal on the server.

Journal storage can be useful if you need to resend a message at a later point. For example, suppose you send a message to a queue and then receive negative acknowledgement that it could not be delivered. Acknowledgement messages do not contain the body of the original message; instead they give you some header information and a correlation ID that corresponds to the original message. If you have journal recording turned on, you can use this correlation ID to locate the original message in your computer's journal queue, re-create the message object, and resend it.

Note

You can use the ReceiveByCorrelationId or the PeekByCorrelationId methods to retrieve a message by its correlation ID. Note that several messages may have the same correlation ID, and these methods will retrieve the first message in the queue with the given ID.

There are a few caveats you should note about journal queues:

  • There is one global journal queue per computer. All messages sent from that computer will be recorded in that journal queue, whether they are delivered successfully or not. In addition, each queue has its own associated journal queue.

  • There are two properties that control how journals are used. If you set the UseJournalQueue property on the MessageQueue object, you enable journal storage for any messages received by that queue, not messages sent with that object. The messages sent with the queue will be placed in the queue journal. If you set the UseJournalQueue property on the Message object, you enable system journal storage; this means that messages sent from your system will be placed in the sender's system queue.

  • Journal queues have a maximum size, called a quota. This size is limited by the disk capacity of the computer on which the queue resides. After the queue capacity is reached, messages that would have been sent to the journal queue are no longer saved in the system. No errors are raised when this occurs. It is important that you periodically purge your journal queues to prevent this from occurring. For more information, see How to: Purge Queue Contents.

  • Journal queues are silent — that is, they cannot create acknowledgement messages of their own, send removed messages to dead-letter queues, or process time-outs.

For instructions on setting up journal storage for your messages, see How to: Store Messages in Journal Queues.

See Also

Tasks

How to: Store Messages in Journal Queues

How to: Purge Queue Contents

Other Resources

Sending and Serializing Messages