防止rabbitmq重新发送消息 [英] Prevent rabbitmq from resending messages
问题描述
我在 centos 6 上使用 rabbitmq 版本 3.2.4.我将它用作工作队列,并且有一些订阅者在监听队列.每个订阅者处理大量数据.因此,处理每条消息可能需要 30 多分钟.这些消息只是概述我需要订阅者执行什么的工作对象.
I am using rabbitmq version 3.2.4 on centos 6. I am using it as a work queue and have a few subscribers listening on the queue. Each subscribers processes a lot of data. Hence, it can take over 30 minutes to process each message. The messages are just work object outlining what I need the subscribers to execute.
问题出现在rabbitmq在大约25分钟左右后将相同的消息重传给不同的订阅者时;而前一个订阅者仍在处理消息.
The problem arises when rabbitmq retransmits the same message to a different subscriber after about 25 minutes or so; while the previous subscriber is still processing the message.
我如何防止rabbitmq 重新发送消息,因为第一个订阅者尚未死亡并且仍在处理中.我试过设置/取消设置心跳标志无济于事.
How can i prevent rabbitmq from resending the message as the first subscriber hasn't died and it is still processing. I have tried setting/unsetting the heartbeat flag with no avail.
推荐答案
如果您通过在每个请求中添加消息序列 no 来防止重新发送问题会更好.收到消息时,检查是否重发.
It will be better if you protect from the resending problem by adding a message sequence no into every request. When receiving the message, to check it is resending or not.
这篇关于防止rabbitmq重新发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!