[rabbitmq-discuss] Acknowledged Messages Requeued

Emile Joubert emile at rabbitmq.com
Fri Nov 11 16:10:59 GMT 2011

Hi Ben,

On 11/11/11 15:12, Ben Lewis wrote:
> I have got a direct exchange feeding a durable queue, if I load say
> 50,000 messages onto the queue and then start a consumer to work through
> those item's.
> My consumer creates the connection, then creates the model (I'm using
> .NET) and sets the Qos prefetch count to 1, then calls BasicGet,
> processes the message, sends an ack (BasicAck), then enumerates until
> BasicGet returns null. Finally disposing the model and closing the
> connection.

You don't need to set QoS if you retrieve messages synchronously
(BasicGet). QoS makes sense with BasicConsume. That is not the cause of
your trouble though.

> If I restart the host I have the RabbitMQ broker running on (Windows)
> after processing and ack'ing 40,000 messages while my consumer is
> working through the remaining items, when the RabbitMQ broker comes back
> online the 40,000 messages are redelivered (even though they were
> acknowledged).
> Is this supposed to happen?

No. Acknowledged messages are forgotten about by the broker, so you
should not be seeing them again. What is the output of

rabbitmqctl list_queues name messages_ready messages_unacknowledged

before and after the restart? Is it possible that you are somehow not
acknowledging the messages? Do you get the same result if you use the
noAck flag of BasicGet?

If you are using transactions and failing to commit the transaction then
you could see apparently acknowledged message reappearing - is that a

> If this is by design, any suggestions or advice on how I can minimise
> the number of redelivered messages if the broker dies/restarts?

If you don't care about persisting messages then you can publish the
messages in non-persistent mode (set the delivery mode in the basic
properties to 1).


More information about the rabbitmq-discuss mailing list