使用ActiveMQ遇到了一个监听器方式的消费者一段时间会自动断开连接的问题

Activemq我遇到了一个问, 就是mq部署到外网linux时, 我的消费者用的是messageListener, 可是过半个小时左右, 我在发消息的时候, 消费者就是接收不到了, 而且过一会就会发现mq管理页面发现消费者和mq断开连接, 这是什么原因呢?

问题一直困扰了我好久,最近突然找到了原因,记录一下

首先看一下官方文档

ActiveMQ InactivityMonitor

The ActiveMQ InactivityMonitor is an active thread that checks the connection is still active and if it suspects the connection is not functioning correctly, it closes the connection.

Connections are monitored by:

  • Ensuring data is read from the connection during the specified time period (Max Inactivity Duration).
  • Writing a KeepAliveInfo message to the connection if no normal activemq traffic is sent across the connection during the specified time period.

Each connection has two InactivityMonitors associated, one on each end of the connection. The InactivityMonitor expects to receive data on the connection during a specified time period. If normalActiveMQ traffic has not been sent across the connection during that period, it expects to receive a KeepAliveInfo message sent by the InactivityMonitor on the other end of the connection.

Using the default values; if no data has been written or read from the conne

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值