Working with MSMQ Journal Queues
In one of our internal forums, recently, someone had posted a query regarding issues in connecting and receiving messages from journal queues. The exception they were getting was "Queue ID is not registered in DS". I hadn't worked with Journal queues before, but this error seemed to me to be related to the queue path.
In my earlier blogs (here and here), I had discussed about the importance of specifying the right name for the queue and also mentioned how the path will typically look like. I decided to give it a try and created a private queue on my local machine and enabled journaling on it. Enabling journaling is as trivial as checking a checkbox in the queue property window. You can also enable it by setting the UseJournalQueue property on the message.
Having done this, I used the syntax as described on MSDN Documentation.
MessageQueue queue = new MessageQueue(".\\test\\journal$");
To my surprise, I got an exception stating "A workgroup installation computer does not support the operation." Well, it isn't really a surprise, since this syntax is for public queues and that's what the error message is also indicating. The following are the various syntaxes that did work for me. You could use either of the following based on your own preferences. Note that the "test" in the queue path is name of the private queue that i created.
MessageQueue queue = new MessageQueue(".\\private$\\test\\journal$");
MessageQueue queue = new MessageQueue(".\\private$\\test;journal");
The casing for "journal" doesn't matter and you can very well specify it as "JOURNAL". So much for local private queue. I quickly tried accessing the journal queue for a remote private queue as well, and following worked for me
MessageQueue queue = new MessageQueue("FormatName:DIRECT=OS:server\\private$\\remote;journal");
Where "server" is the remote machine name. Again, "journal" can be specified as "JOURNAL" as well. The following, though is an extension of what worked in case of local private queue, didn't work for remote private queue and I got a "Format name is invalid" exception.
MessageQueue queue = new MessageQueue("FormatName:DIRECT=OS:punhjw30076\\private$\\remote\\journal$");