当 IBM Queue Manager 断开连接时如何接收通知?

发布于 08-11 11:04 字数 521 浏览 5 评论 0原文

我们当前正在构建一个需要与某些 IBM WebSphere 队列进行通信的应用程序。队列的另一端有另一个世界。由于一些未知的情况(对我来说),连接到 MQQueueManager 每次需要 17 秒,但是之后通过队列发送和接收消息并不是一项耗时的工作。由于我们现在将 Web 服务放置在 WebSphere 前面,因此我们提出了装饰和缓存 MQQueueManager 和 MQQueue 的想法,并在发送每条消息之前验证它们是否已连接或分别打开;如果没有,我们尝试连接到 MQQueueManager,分别打开 MQQueue(同样,连接到 MQQueueManager 需要 17 秒,打开 MQQueue 是“即时”)。因此,我们期望 WebSphere 每隔一段时间就会断开 MQQueueManager 的连接(我不能确定,因为我们现在无法对此进行大量测试,但我们应该谨慎),而不幸的调用程序将等待 17 秒才能重新连接。从目前的情况来看,我们无法预测这件事情的发生。 我们当前的实现使用 .NET 的 WebSphere MQ 类。当MQQueueManager断开连接或关联队列关闭时,我们是否有可能收到回调通知?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时光的容颜2024-08-18 11:04:40

是的!如果您使用最新的 WMQ .Net 类和最新的 IA9H SupportPac 你会得到一个异步回调方法。 (这附带了 .Net 示例代码,展示了如何注册和使用回调。)据我所知,此方法将在回调例程可用时向您的回调例程传递一条消息,或者如果连接可用,则将异常传递给已注册的异常侦听器。丢失或队列设置为 GET(DISABLED)

此处获取最新的 WMQ 客户端。查找名称如 MQC* 的 SupportPac。 v8.0 客户端是 MQC8,v9 客户端是 MQC9 等。

如果您有旧版本的 .Net WMQ 类并且由于某种原因无法升级,您可以始终保持一个单独的线程打开并定期轮询队列。不过,不要太频繁地进行轮询。过去我见过人们使用类变量作为倒计时器。每次成功检索消息或将消息放入队列时,计时器都会重置为其最大值。当计时器达到零时,轮询队列。这样,您仅在连接上没有其他流量时轮询队列。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文