title: Spring JmsListener not picking up messages
body: <p>I have a Spring Boot 2.1.4 application which uses the <code>DefaultJmsListenerContainerFactory</code> to consume messages from IBM MQ 9.0 over SSL. I have noticed that in some unknown circumstances the listener’s connection to MQ still exists and is reported as connected within the logging and MQ Explorer, however the listener does not consume messages and they remain on the queue until the Spring Boot app is restarted. Logs do not report anything in the app or Queue Manager.</p>
  <p>Ideally, I would like the <code>JmsListener</code> to recognize the fail state and re-connect on its own. I have read that configuring Heartbeat or Keep Alive on MQ and the client would help. The MQ channel is set to a 5 sec heartbeat interval, but not sure how to configure this or the keep-alive in our Spring Boot app.</p>
  <p>Note: my <code>JmsListener</code> does reconnect on its own in the event of a caught exception with the MQ connection.</p>
  <p>Jms Factory code:</p>
  <pre><code>@Bean
  public JmsListenerContainerFactory&lt;?&gt; myFactory(ConnectionFactory connectionFactory,
          DefaultJmsListenerContainerFactoryConfigurer configurer) {
      DefaultJmsListenerContainerFactory defaultJmsListenerContainerFactory = new DefaultJmsListenerContainerFactory();
      defaultJmsListenerContainerFactory.setTransactionManager(jmsTransactionManager(connectionFactory));
      defaultJmsListenerContainerFactory.setSessionTransacted(true);
      defaultJmsListenerContainerFactory.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
      defaultJmsListenerContainerFactory.setErrorHandler(new DefaultJmsErrorHandler());
      defaultJmsListenerContainerFactory.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
      configurer.configure(defaultJmsListenerContainerFactory, connectionFactory);
      return defaultJmsListenerContainerFactory;
  }
  </code></pre>
  <p>Listener:</p>
  <pre><code>@JmsListener(destination = &quot;${sys.to.app.core.queue}&quot;, containerFactory = &quot;myFactory&quot;)
  @Transactional(propagation = Propagation.REQUIRES_NEW)
  public void onMessageReceived(final Message message) throws InboundQueueMessageException {...}
      
  </code></pre>