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?

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.