到 TIBCO EMS 服务器的 Spring JMS 使用者会自行过期 [英] Spring JMS Consumers to a TIBCO EMS Server expire on their own

查看:32
本文介绍了到 TIBCO EMS 服务器的 Spring JMS 使用者会自行过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们构建了一个 Spring Boot 消息服务,它侦听托管在 TIBCO EMS(企业消息服务)服务器上的 JMS 队列.这是一个相当简单的应用程序,它接收 JMS 消息、执行一些数据操作并更新数据库.

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.

问题是,有时队列中没有 JMS 使用者,并且不会处理传入的消息.但是,Spring Boot 应用程序已启动并正在运行(由 ps -ef 验证).重新启动应用程序会恢复消费者,但不幸的是,这在生产等中不是可行的解决方案.

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.

其他有趣的事实:

  • 我们观察到,当 JMS 服务器接受 SSL 流量并作为容错对部署时会发生这种情况(尽管这仍是一个结论性的观察结果)
  • 当消费者宕机时,日志中绝对没有任何指示(如错误).
  • 我们使用的是 Spring-JMS (4.1.0) 和 TIBCO EMS (8.3.0)

实例化 DefaultJmsListenerContainerFactory 的代码片段:

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;
}

JMS 侦听器:

@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
}

当我们尝试在 Spring Boot 和 TIBCO 端设置额外的日志记录时,我们想检查以下几点:

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

  • 是否会出现消费者闲置超过一定时间,自动过期的情况?
  • 这是由 DMLC 设置(例如 idleConsumerLimit、idleTaskExecutionLimit 等)管理的吗?
  • 可以在上面提到的Spring Boot代码中查看这些属性吗?例如,在上面的代码中,JMS 侦听器是由 DefaultJmsListenerContainerFactory 在幕后创建的.那么我们如何访问 DMLC 对象,以便我们可以调用 getIdleConsumerLimit()、getIdleTaskExecutionLimit() 等方法.

感谢您的投入,普拉巴尔

Thanks for the inputs, Prabal

推荐答案

最有可能的是,网络中的某些东西(路由器、防火墙等)正在悄悄地丢弃空闲连接.

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

虽然不是 JMS 规范的一部分,但大多数供应商实现了某种心跳机制,以便客户端/服务器不时交换 ping,以防止网络组件执行此类操作和/或检测此类情况.

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.

查看 Tibco 文档以了解如何配置心跳(他们可能会称之为其他名称).

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

这篇关于到 TIBCO EMS 服务器的 Spring JMS 使用者会自行过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆