IBM JMS 连接

发布于 2024-09-11 01:08:46 字数 478 浏览 7 评论 0原文

我目前正在使用 C# 工作,我需要检查我建立的 JMS 连接的状态(是否已连接/已断开连接)。我确信我可以成功连接和断开连接......只是我需要在用户界面中显示连接的状态。

JMS 连接是否有任何属性指示连接状态?或者还有其他方法可以用来检查连接状态吗?

感谢您的帮助。 :)


目前,我使用 ExceptionListener 来侦听任何异常,并且当捕获任何异常时,标志将设置为 false。当我连接时,我会将标志设置为 true ,反之亦然,当我断开连接时,我会将标志设置为 false 。

我的 UI 将使用此标志来检测连接是否已建立。

但是我在想,如果 IBM 连接有任何属性/方法可以用来显示连接的状态,那么它是一个更好的解决方案。对于 SonicMQ,有 .getConnectedState() 显示连接是活动的还是非活动的。 我想知道 IBM 是否有类似 SonicMQ 的东西?

I'm currently working in C# and I need to check the state of the JMS connection that i made (whether it's connected / disconnected). I'm sure that I can connect and disconnect succesfully..its just that i need to display the status of the connection in my UI.

Is there any properties of the JMS connection that states connection status? Or is there any other method that i can use to check the connection status?

Thanks for your help. :)


Currently, I'm using the ExceptionListener to listen for any exceptions and a flag will be set to false when any exception is catched. And when I'm connecting, I will set the flag to true vice versa when i disconnect, I will set the flag to false.

This flag will be used by my UI to detect whether the connection is up or not.

However I was thinking that if theres any property / methods of the IBM connection which can be used to show the state of the connection as its a much better solution. For SonicMQ, theres .getConnectedState() which shows whether the connection is active or inactive. I was wondering whether if IBM have something similar to SonicMQ?

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

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

发布评论

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

评论(1

千寻… 2024-09-18 01:08:47

您可以使用 Connection.setExceptionListener() 方法,用于异步通知连接中检测到的异常。如果检测到问题,则调用 onException() 方法。

请务必设置 FAILIFQUIESCE 工厂和目标上的属性,以便当管理员关闭 QMgr 时,您的连接会收到通知并以有序的方式关闭。

在 WMQ v7 中,可以在传输中启用会话重新连接。在这种情况下,应用程序可能不知道连接已中断,但您可以将其视为已连续连接。

请注意,大多数情况下,异常是由应用程序的 API 调用驱动的。因此,如果连接丢失,您可能无法实时了解,而是知道何时进行 API 调用。如果应用程序长时间处于空闲状态并且您希望实时显示连接状态。另请参阅“如何查明 JMS 连接是否存在? ”了解有关该主题的更多信息。

WMQ v7 具有自动重新连接客户端的选项。您必须在客户端和服务器上都使用 v7 才能正常工作。由于 v6 已于 2011 年 9 月终止生命,因此最好在 v7 上开发此应用程序。您可以将 v7 客户端下载为 SupportPac MQC7。当 JMS 客户端重新连接时 启用后,应用程序可能不知道连接活动,除非在重建连接时响应 API 调用出现延迟。该延迟的长度取决于管理员和连接工厂中设置的通道调谐。

You can use the Connection.setExceptionListener() method to be notified asynchronously of exceptions detected in the connection. If a problem is detected the onException() method is called.

Be sure to set the FAILIFQUIESCE property on the factories and destinations so that your connection is notified and closed in an orderly fashion when the QMgr is shut down by the administrator.

In v7 of WMQ it is possible so enable session reconnection in the transport. In this case, the application may not be aware that the connection was interrupted but you can treat it as having been continuously connected.

Note that, for the most part, exceptions are driven by the application's API calls. So if the connection is lost, you may not know about it in real time but rather find out when an API call is made. If the application sits idle for long periods of time and you want a real-time display of connection status. Please see also "How to find out if JMS Connection is there?" for more on that topic.

WMQ v7 has options to reconnect the client automatically. You must be using v7 at both the client and the server for this to work. Since v6 is end-of-life as of Sept 2011, it is best if you develop this app on v7. You can download the v7 client as SupportPac MQC7. When JMS client reconnect is enabled, the application may not be aware of the connection activity except as a delay in responding to an API call while the connection is rebuilt. The length of that delay depends on channel tuning set by the administrator and in the connection factory.

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