JMS catching when the JMS server leaves

When there is a network problem that causes the client to disconnect from the JMS server, is there any other way to detect the problem other than waiting until the next JMS message is sent?

+4
source share
3 answers

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

ExceptionListener will receive a notification of more problems than the actual disconnect, so you may need to filter out a JMSException that will be JMSException to the listener.

+4
source

An ExceptionListener is not necessarily enough. You also need to catch exceptions for any JMS calls you make (for example, sending messages). See Reconnecting a JMS Listener to JBossMQ

+3
source

if you work in MQ and want to solve this problem, install a local instance of MQ. More licenses, but you'll get a delivery guarantee if your core corporate MQ goes down.

Alternatively, use Spring and let the infrastructure perform a connection recovery.

0
source

Source: https://habr.com/ru/post/1300010/


All Articles