English 中文(简体)
How to receive notification when IBM Queue Manager gets disconnected?
原标题:

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?

最佳回答

Yes! If you use the latest WMQ .Net classes and the latest IA9H SupportPac you get an asynchronous callback method. (This comes with .Net sample code showing how to register and use the callback.) 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 latest WMQ Client here. Look for SupportPacs with names like MQC*. The v8.0 client is MQC8, the v9 client is MQC9, etc.

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.

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签