[rabbitmq-discuss] Ordering guarantees for multiple publishers, one queue and one consumer?
Francesco Mazzoli
francesco at rabbitmq.com
Wed Sep 5 17:16:30 BST 2012
Hi Tuure,
At Wed, 5 Sep 2012 16:30:05 +0300,
Tuure Laurinolli wrote:
> Assuming nodes A and B publish messages to exchange X with one queue Q that
> has one consumer C, is it possible to guarantee ordering of messages from A
> and B to C, assuming A and B have a side channel over which they can
> coordinate their actions but can't communicate with C directly? If they were
> able to communicate with C directly, the problem would be trivial, since B
> could ask C "Have you received a message from A?" and only publish if the
> answer is yes.
>
> Without being able to communicate with C, is it e.g. enough for A to do a
> transactional publish with mandatory flag, wait for commit-ok and only then
> give B signal that would allow B to do its publish? Will guarantee that the
> message from A will arrive to C before the message from B? It seems to me that
> AMQP 0-9-1 does not guarantee this (essentially allowing each incoming channel
> to have its own FIFO queue from with an outgoing channel would pull messages
> in undefined order). Does RabbitMQ offer stronger guarantees here?
As discussed on IRC, the answer is yes: with rabbit, after receiving an
confirm/commiting a transaction, messages published afterwards to the same queue
will come after. So your plan will work, and you don't even need transactions,
confirms are enough - and the mandatory flag is irrelevant here.
--
Francesco * Often in error, never in doubt
More information about the rabbitmq-discuss
mailing list