First of all i declare exchange,queue and bind them togerther. i basicPublish a message to this queue, so there are one message you in the queue. At this time i start my consumer program(with autoAck = true) and debug it, when i run to basicConsume(xxx), the message was lost! In my opinion consumer will send basic.ack to broker when it run to the method nextDelivery(), but in fact when i will declare a consumer, the message in queue is taken. why? Can someone tell me when rabbitmq delete message from queue? after the method basicConsume() or nextDelivery()??? thx~~~
Asked
Active
Viewed 1.7k times
1 Answers
18
autoAck = true
because of this
you are telling RabbitMQ to automatically acknowledge the message when it is consumed. acknowledging a message tells RabbitMQ that it has been taken care of and RabbitMQ can delete it now.
set autoAck to false if you want to manually acknowledge the message after you are done processing it.

Derick Bailey
- 72,004
- 22
- 206
- 219
-
2thanks Derick Bailey! I had read the source code yesterday.i found that it will take the message and save in the local queue when i start a consumer without run the nextDelivery(). – chris.lin Sep 24 '15 at 00:41