I realize I'm coming to this discussion a bit late and you've probably already coded this app up. In the event you ever need to modify it or for anyone else who might need to do something similar, I have a couple of observations.
First, if you can do this with a v7 QMgr and a v7 WMQ client this would be the preferred solution. In v7, the .Net support has been moved from a SupportPac to part of the base product. There is considerable new functionality, some bug fixes and better performance. Also, on v7 you can use pub-sub...which brings me to my second observation.
Based on the description in the original post, I would have done this in Pub-Sub. The app which puts the message needs only put one and it does not even need to know it's putting to a topic. You can actually put up an alias over a topic that makes it look like a queue to the message producer. Your consuming apps can then either subscribe or you can make two administrative subscriptions so that the published messages go to two queues that you designate. Your apps then each have a dedicated queue and no coding changes are involved for the producer and the batch app, it's just configuration. Of course the app driving the transactions would need to actually consume the messages rather than browse them.
The advantages here are several:
- As the queue fills up with messages, indexing gets flushed to disk and above a threshold you'll see a performance hit which may be significant. Therefore, the current method doesn't scale all that well.
- With the pub-sub method you can have multiple instances of either the real-time or batch apps or both, and these can be on the same or different QMgr. Scaling up is easy.
- You eliminate the dependency between the real-time and batch apps needing to be on the same QMgr.
- More transparent administration. If you see messages building up in the real-time queue you know you have a problem.
A couple of completely different issues here as well. One of these is to use the Fail if Quiescing option. The purpose of this is that when the QMgr is shut down cleanly this option causes your API call to end with a return code indicating the QMgr is shutting down. If you do not include this option then it is possible with two or more connected apps that the QMgr will never shut down cleanly and need to be forced down or have its processes killed with brute force. As a rule, always use Fail if Quiescing on all API calls that support it. The reason it exists at all is for people who need XA transactionality but for some reason can't use it. In this scenario, the CONNECT and the first GET or PUT call uses Fail if Quiescing set and subsequent GET or PUT operations do not. This causes the QMgr to wait for the entire set of GET/PUT calls to complete but then the next CONNECT or GET/PUT uses Fail if Quiescing so the QMgr has a chance to shut down if necessary.
The other observation here is that there is no Catch in the code here. I'm guessing there's one in scope further up the call stack? It is always advisable to print the WMQ return code from an exception so that you can track down the root cause. On consulting engagements I always advise clients that failure to print the return code (or the linked exception for JMS/XMS code) is a showstopper that should prevent promotion of an app to Production. It's really that important. Even if you have a catch in the code that calls getMessage(), someone reusing the example code snippet here might not realize this important piece is missing.