[rabbitmq-discuss] Batch Acknowledge

Davide Maestroni davide.maestroni at gmail.com
Tue Oct 19 18:30:50 BST 2010


Hi all,

I'm new to RabbitMQ and I am still trying to put everything together, so
please be patient.

What I want to achieve is a queue in which all the messages persist until a
"consumer" (not sure if it is really a consumer actually)  do some batch
processing on N messages, like updating a separate DB, and, only when
everything has completed correctly, send an acknowledge so that the queue
can release the last delivered N messages.
As per my understanding I can "declare" a queue and then start reading from
it using basicGet() API. Then, after processing the desired number of
messages, I call basicAck(deliveryTag, true) passing the tag of the last
read message.
In my case it is both important to keep the message ordering and not to lose
any message even if the consumer or the broker crash. In order to achieve
that, I am going to publish messages "mandatory" and "persistent" and then
send an ack in the consumer after successfully securing the data in some
other place.
What I want to be clear here is: is it correct to say that if the consumer
crashes after M basicGet() (but before sending the ack), at restart the same
M messages will be returned calling basicGet()? I.e. are the messages
removed from the queue only after receiving the acknowledge?
If it is not so, do I have to call basicRecover()? Can I do it even if I
don't call basicConsume()? And most importantly, which is the order of the
messages when calling basicRecover() after a crash and restart of the
consumer node?

A final question: if a message is flagged as "mandatory", how long the queue
wait for a consumer to be ready before returning the message to the sender?

Thanks and Best Regards,

Davide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101019/93f784c9/attachment.htm>


More information about the rabbitmq-discuss mailing list