I am trying to write a health check for our JMS connection that connects to MQ using IBM JMS integrations code ibm-messaging/mq-jms-spring. I need to detect that the connection to MQ has been lost. I hooked the exceptionListener for the DefaultJmsListenerContainerFactory and that tells me when I lose the connection to MQ but I cannot find anything in the JMS stack that tells me when the connection gets (re)established.
Code that calls the ExceptionListener
@Override
protected void establishSharedConnection() {
try {
super.establishSharedConnection();
}
catch (Exception ex) {
if (ex instanceof JMSException) {
invokeExceptionListener((JMSException) ex);
}
logger.debug("Could not establish shared JMS Connection - " +
"leaving it up to asynchronous invokers to establish a Connection as soon as possible", ex);
}
}