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

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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站