Spring JMS Consumers to a TIBCO EMS Server expire on their own

核能气质少年 提交于 2021-02-08 10:21:12

问题


We have built a Spring Boot messaging service that listens to a JMS queue hosted on a TIBCO EMS (Enterprise Messaging Service) Server. It is a fairly straightforward application that receives a JMS message, does some data manipulation and updates a database.

The issue is that, occasionally, there are no JMS consumers on the queue, and incoming messages are not processed. However the Spring Boot app is up and running (verified by ps -ef). Restarting the app restores the consumer, but unfortunately this is not a feasible solution in production etc.

Other facts of interest:

  • We have observed this to happen when the JMS server accepts SSL traffic and is on deployed as a Fault Tolerant pair (although this has been a conculsive observation yet)
  • There is absolutely no indication in the log (like an error) when the consumer goes down.
  • We are using Spring-JMS (4.1.0) and TIBCO EMS (8.3.0)

Code Snippet of instantiating a DefaultJmsListenerContainerFactory:

@Bean
public DefaultJmsListenerContainerFactory listenerJmsContainerFactory() {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    TibjmsQueueConnectionFactory cf = new TibjmsQueueConnectionFactory("tcp://localhost:7222");
    cf.setUserName("admin");
    cf.setUserPassword("");
    factory.setConnectionFactory(cf);
    return factory;
}

The JMS Listener:

@JmsListener(destination = "queue.sample", containerFactory = "listenerJmsContainerFactory")
public void listen(TextMessage message, Session session) throws JMSException{
    System.out.println("Received Message: "+message.getJMSMessageID());
    System.out.println("Acknowledgement Mode: "+session.getAcknowledgeMode());
// Some more application specific stuff
}

While we are trying to setup additional logging on both the Spring Boot and TIBCO side, we would like to check some points like:

  • Can there be a situation where a consumer idle for more than a certain time, automatically expires?
  • Is this something that is governed by DMLC settings like idleConsumerLimit, idleTaskExecutionLimit etc.?
  • Can these properties be viewed in the Spring Boot code mentioned above? For instance in the code above, the JMS Listener is being created under the hood by the DefaultJmsListenerContainerFactory. So how can we access the DMLC object so that we can invoke methods like getIdleConsumerLimit(), getIdleTaskExecutionLimit() etc.

Thanks for the inputs, Prabal


回答1:


Most likely, something in the network (router, firewall etc) is silently dropping idle connections.

While not part of the JMS spec, most vendors implement some kind of heartbeat mechanism so that the client/server exchange pings from time to time, to prevent such actions by network components and/or to detect such conditions.

Look at the Tibco documentation to figure out how to configure heartbeats (they might call it something else).



来源:https://stackoverflow.com/questions/43993953/spring-jms-consumers-to-a-tibco-ems-server-expire-on-their-own

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!