[英]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: 这些问题总是由以下两个问题之一引起的:
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.