Share via


Writing in MSMQ's personal journal

If you are doing some testing and want to enable journal messages so you can track what's going on, make sure you know what sort of journaling you've picked because there are two types:

 

Positive Source Journaling

If you set the MESSAGE to Journal (via application code) then this tells the Sending queue manager to put a copy in the "Journal messages" queue under "System Queues" in Computer Management on the sending machine. This copy is only created when the message successfully leaves the machine. 

 

Negative Source Journaling

If you set the MESSAGE to Dead Letter (via application code) then this tells the Sending queue manager to put a copy in the "Dead-letter messages" or "Transactional dead-letter messages" queue under "System Queues" in Computer Management on the sending machine. This copy is only created when the message fails to leave the machine (or fail to be read in the case of transactional messages).  

 

 

Target Journaling 

If you set the QUEUE to Journal (via ticking the "Enabled" box) then this tells the Receiving queue manager to put a copy in the "Journal messages" queue under the destination queue in Computer Management on the receiving machine. This copy is only created when the message is successfully read from the queue.

 

 

Important Notes

  • The sending machine is not always the machine you think it is. If you are making use of Routing Servers then each machine is a sender to the next one in the chain. Messages can therefore fail to send at any point so check the System Queues on all of the servers.
  • MSMQ will not clean up journal messages for you. Unless you have some process in place, be it automated or manual, to purge the queues or process these messages then your machine will eventually implode.To prevent this happening:
    • Use Performance Monitor to check how many Journal messages there are in the system.
      • On the sender: "MSMQ QueueMessages in Journal QueueComputer Queues"
      • On the receiver: "MSMQ QueueMessages in Journal Queue<serverqueuename>"
    • If you enable the Journal property of a queue, make sure you also choose "Limit journal storage to (KB):"
    • If you enable the Journal property of a message, make sure you also choose  "Limit journal storage to (KB):" in Storage limits for the sending machine. 

 

Comments

  • Anonymous
    February 22, 2008
    As always: NIce to read those tips as reminders of what too easily may be forgotten. Thanks for your valuable blog, John!

  • Anonymous
    March 12, 2009
    Is there any way to look at the journal via .NET to see when the last read message was arrived/sent?

  • Anonymous
    March 13, 2009
    Hi Justin, You can open up a journal queue just like any other. This page on MSDN has examples for referencing journal queues: MessageQueue Class http://msdn.microsoft.com/en-us/library/system.messaging.messagequeue.aspx You would then need to PEEK the messages to read their arrived/sent properties. Cheers John Breakwell (MSFT)

  • Anonymous
    March 25, 2009
    Thanks, was able to get it working, the major challenge i had in the end was the correct notation. to access a private queue journal was .private$queuejournal$ almost every website i checked dropped the $ on the private when referring to journal. i found it was required in both places.

  • Anonymous
    March 25, 2009
    Hi Justin, Yes, dropping the $ from Private is such a basic error and I hope you didn't find any Microsoft sites doing this. With practice it will become second nature to include it  :-) Cheers John

  • Anonymous
    April 24, 2009
    The comment has been removed

  • Anonymous
    April 24, 2009
    Hi Klaus, Both are valid. ".private$queuejournal$" works for system.messaging (which my link above references). ".private$queue;journal" works for COM (http://msdn.microsoft.com/en-us/library/ms883473.aspx). Cheers John Breakwell (MSFT)