If the connection with a JMS broker is interrupted, the client and the server have to restore the connection.
This functionality is provided by CXF, which is included in Talend ESB, in the MessageContainerListener. The listener checks the connection, reports warning if the connection is broken and restores the connection if possible.
When using Connection Pooling, broken connections are not automatically removed from the pool. The solution is to set short expire timeout for connections in pool:
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.pool.PooledConnectionFactory; ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); PooledConnectionFactory pcf = new PooledConnectionFactory(); pcf.setExpiryTimeout(5000); // Make sure to set expiry timeout as the default of 0 prevents reconnect on failures pcf.setConnectionFactory(cf); JMSConfiguration jmsConfig = new JMSConfiguration(); jmsConfig.setConnectionFactory(pcf);