[rabbitmq-discuss] Atomic acking of a specific set of messages
Matthias Radestock
matthias at rabbitmq.com
Mon Jul 8 10:37:57 BST 2013
On 07/07/13 19:10, peter at vagaband.co wrote:
> The flag to indicate you're acking multiple messages will not work as
> that limits you to work with just one batch, right? And you cannot
> pick and choose which batch of messages you can or cannot ack with
> that mode (i.e. batch 2 might succeed, batch 3 might fail and batch 4
> might succeed. so if you ack batch 4, everything will be acked).
Correct. Besides multi-ack is not atomic anyway.
> The key here is treat a batch of messages as an atomic unit so if a
> single message consumer node dies or all message consumer nodes die
> or a rabbitmq node dies, then the whole batch can be failed to be
> re-tried later.
There is no atomic multi-message ack in RabbitMQ.
And even if there was one, I don't think it would help you. In
particular, how would exactly-once semantics be retained when your
application (the one that accumulates messages into batches) crashes
after submitting the batch but before sending the hypothetical
atomic multi-message ack?
> is there some pattern I could implement using what RabbitMQ provides
> to achieve this?
The pattern to get the effect of exactly-once in RabbitMQ is the same as
that employed by stomp and trident, namely to ensure idempotence (of
batches, in case of trident, and of messages in case of rabbit). Quite
how that can be achieved depends on the application.
Matthias.
More information about the rabbitmq-discuss
mailing list