dqgg25493
2014-09-09 16:21
浏览 238
已采纳

RabbitMQ消息丢失

I use Python api to insert message into the RabbitMQ,and then use go api to get message from the RabbitMQ.

Key 1: RabbitMQ ACK is set false because of performance.

I insert into RabbitMQ about over 100,000,000 message by python api,but when I use go api to get message,I find the insert number of message isn’t equal to the get number.The insert action and the

get action are concurrent.

Key 2:Lost message rate isn’t over 1,000,000 percent 1.

Insert action has log,python api shows that all inserted message is successful.

Get action has log,go api shows that all get message is successful. But the number isn’t equal.

Question1:I don’t know how to find the place where the message lost.Could anyone give me a suggestion how to find where the message lost?

Question2:Is there any strategy to insure the message not lose?

图片转代码服务由CSDN问答提供 功能建议

我使用Python api将消息插入RabbitMQ,然后使用go api从RabbitMQ获取消息。 / p>

键1 :出于性能原因,RabbitMQ ACK设置为false。

我通过Python向RabbitMQ中插入了大约1亿条消息 api,但是当我使用go api来获取 message时,我发现消息的插入数与获取数不相等。insert操作和

get操作是并发的。

键2 :消息丢失率不超过1,000,000%1。

插入操作具有日志,python API 显示所有插入的消息均成功。

获取操作已记录日志,go api显示所有获取消息均已成功。 但是数量不相等。

问题1 :我不知道如何找到丢失消息的地方。有人可以给我一个建议如何找到丢失消息的地方吗?

Question2 < / strong>:是否有确保邮件不会丢失的策略?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doulai5585 2014-09-09 16:38
    已采纳

    In order for you to test that all of your messages are published you may do it this way:

    1. Stop consumer.
    2. Enable acknowledgements in publisher. In python you can do it by adding extra line to your code: channel.confirm_delivery(). This will basically return a boolean if message was published. Optionally you may want to use mandatory flag in basic_publish.
    3. Send as many messages as you want.
    4. Make sure that all of the basic_publish() methods returnes True.
    5. Count number of messages in Rabbit.
    6. Enable Ack in consumer by doing no_ack = False
    7. Consume all the messages.

    This will give you an idea where your messages are getting lost.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题