开发者

JMS catching when a JMS server goes away

开发者 https://www.devze.com 2022-12-19 09:23 出处:网络
When there is a network problem which results in the client being disconnected from the JMS server, is there some other way to detect the problem othe开发者_StackOverflow社区r than waiting until the n

When there is a network problem which results in the client being disconnected from the JMS server, is there some other way to detect the problem othe开发者_StackOverflow社区r than waiting until the next JMS message being sent fails?


You can register an ExceptionListner with the JMS Connection using Connection.setExceptionListener(ExceptionListener)

The ExceptionListener will get notified of more problems than an actual disconnection, so you may have to filter the JMSException that gets passed to the listener.


ExceptionListener isn't necessarily enough. You also need to catch exceptions on any JMS calls you make (sending messages, for example). See Reconnecting JMS listener to JBossMQ


if your are running on MQ and looking to solve this problem, install a local MQ instance. More license but you will get guaranty delivery if your main corporate MQ goes down.

Other Option, use Spring and let the framework do the recovery of the connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消