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.

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

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝