简体   繁体   English

AMQP使用者(侦听器适配器+ SimpleMessageListenerContainer)持有消息

[英]AMQP consumer(listener adapter + SimpleMessageListenerContainer) holding message

Recently we came across a situation where the messages were taken up from the queue by the consumer but did not reach the listener bound to that queue. 最近,我们遇到了这样一种情况,即消费者从队列中接收了消息,但没有到达绑定到该队列的侦听器。 We were able to make this assertion because we have an interceptor on our listeners (which prints a log message) that was not triggered for those messages. 我们之所以能够做出这样的断言,是因为我们的侦听器上有一个拦截器(打印日志消息),而该拦截器并未针对这些消息触发。 As soon as we restarted the server(tomcat) the messages were consumed and acked. 一旦我们重新启动服务器(tomcat),消息就被消耗并确认。

We would like to know the reason for such a behavior. 我们想知道这种行为的原因。 We analyzed the thread dumps but with no success. 我们分析了线程转储,但没有成功。

Such issues are invariably caused by one of two problems: 这些问题总是由以下两个问题之一引起的:

  • container thread(s) "stuck" in user code 用户代码中的容器线程“卡住”
  • some network component (eg router) silently closing a connection that it thinks is idle such the the client and/or server is not aware that the connection is closed. 一些网络组件(例如路由器)静默关闭它认为空闲的连接,这样客户端和/或服务器不会意识到该连接已关闭。

You seem to have eliminated the first (assuming your analysis is correct) so it's most likely the second. 您似乎已经消除了第一个(假设您的分析是正确的),因此很可能是第二个。

You can enable heartbeats on the connection to avoid the network thinking a connection is idle. 您可以在连接上启用心跳,以避免网络认为连接空闲。 Refer to the RabbitMQ documentation. 请参阅RabbitMQ文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Spring AMQP中使用消息侦听器适配器获取消息对象 - Getting message object using message listener adapter in spring AMQP SimpleMessageListenerContainer 批量消息处理 - SimpleMessageListenerContainer bulk message processing 在Spring AMQP中关闭与SimpleMessageListenerContainer相关的连接 - Close connections related to SimpleMessageListenerContainer in Spring AMQP AMQP异步侦听器仅在事件发生后才开始侦听消息 - AMQP async listener starts listening to message only after an event happens Spring AMQP 错误:无法使用传入消息调用侦听器方法 - Spring AMQP Error: Listener method could not be invoked with the incoming message Spring AMQP动态创建RabbitTemplate和SimpleMessageListenerContainer,错误RabbitTemplate未配置为MessageListener - Spring AMQP Dynamically create RabbitTemplate and SimpleMessageListenerContainer, error RabbitTemplate is not configured as MessageListener Spring AMQP中的SimpleMessageListenerContainer和DirectMessageListenerContainer有什么区别? - What's the difference between SimpleMessageListenerContainer and DirectMessageListenerContainer in Spring AMQP? 删除队列后,SimpleMessageListenerContainer上的Spring AMQP通知/事件 - Spring AMQP Notification/Events on SimpleMessageListenerContainer, when queue gets deleted RabbitMQ的Spring SimpleMessageListenerContainer正在中止无效消息 - Spring SimpleMessageListenerContainer for RabbitMQ is aborting on invalid message Springframework 2.5 SimpleMessageListenerContainer消息是否收到回调? - Springframework 2.5 SimpleMessageListenerContainer message received callback?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM