views:

243

answers:

1

Hi,

We are currently building an application that needs to communicate to some IBM WebSphere queues. At the other end of the queues there is another world. Due to some unknown circumstances (for me), connecting to the MQQueueManager takes 17 seconds every time, but sending and receiving messages afterwards through the queues is not a time consuming job. As we are placing now a web service in front of the WebSphere, we came up with the idea of decorating and caching the MQQueueManagers and the MQQueues and verifying before each message sending if they are connected, respectively open; if not, we try connecting to the MQQueueManager, repectively opening the MQQueue (once again, connectiong to the MQQueueManager takes 17 seconds, opening the MQQueue is "instant"). So we are expecting that every once in the while WebSphere would disconnect the MQQueueManager (I cannot tell for sure as we cannot heavily test this for now, but we should be cautious) and the unlucky calling program would wait 17 seconds to reconnect. As things stand now, we cannot predict the occurence of this thing to happen. Our current implementation uses the WebSphere MQ classes for .NET. Is there any possibility for us to receive a callback notification when the MQQueueManager gets disconnected or the associated queues are closed?

+1  A: 

Yes! If you use the latest WMQ .Net classes and the latest IA9H SupportPac you get an asynchronous callback method. It is my understanding that this method will pass your callback routine a message when one is available or else pass an exception to the registered exception listener if the connection is lost or queue is set to GET(DISABLED).

Get the IA9H SupportPac here: http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24011756&loc=en%5FUS&cs=utf-8&lang=en (This comes with .Net sample code showing how to register and use the callback.)

Get the latest WMQ Client here: //www-1.ibm.com/support/docview.wss?rs=171&uid=swg24019253&loc=en_US&cs=utf-8&lang=en

(Add the http back in the 2nd URL. I can't post more than one link due to spam prevention.)

If you have an older version of .Net WMQ classes and can't upgrade for some reason you can always keep a separate thread open and periodically poll the queue. Don't poll too frequently, though. In the past I've seen people use a class variable as a countdown timer. Each time a message is successfully retrieved or put to the queue, the timer is reset to its max. When the timer reaches zero, poll the queue. This way you only poll the queue when no other traffic is on the connection.

T.Rob
Thanks a lot! That was what I was looking for!
DaeMoohn
It says document not found. Isn't this for free, or should I use my company credentials?
DaeMoohn
Can somebody provide a sample of code? I didn't find anything on the net for .NET classes.
DaeMoohn
T.Rob
When you download IA9H there will be samples provided in the "Tools" subdir of the install. Roger has some samples at http://capitalware.biz but I don't think they are current. Worth a look, though. At least until the SupportPac site comes back online.
T.Rob
Thanks, I thought I needed a corporate IBM user ID to download that SupportPac. I am leaning towards pooling MQQueueManagers (as the queues definitions change "once in a while") and reconnecting or clearing them in the callback. Thanks for pointing me the direction and clearing the reason for this outage.
DaeMoohn
One more question i would have. Will the latest client work with Server 6.0.2?
DaeMoohn
This support pac uses IBM.XMS? That would mean I would have to take a shift from .NET classes for MQ. Quite interesting.
DaeMoohn