[rabbitmq-discuss] ordering semantics

Michael Bridgen mikeb at lshift.net
Wed May 5 17:23:23 BST 2010


Jim,

> I'm trying to get a handle on ordering semantics on the topic exchange.
> 
> Assume there are two publishers, each on their own channel.  Publishers 
> produce a stream of messages.  So:
> 
> Publisher A produces A1, A2, A3 (in that order) Publisher B produces B1, 
> B2, B3 (in that order)
> 
> There is a single subscriber on a queue that all the messages produced 
> by both publishers are targeted to.
> 
> Questions:
> 
> 1. Messages A1, A2, A3 are received in that order.  Messages B1, B2, B3 
> are received in that order.  Correct?

Yes, in the absence of relivery due to e.g., recover.

> 2. Messages from A can be interleaved from B as in: A1, A2, B1, B2, B3, 
> A3.  (Still subject to the constraint from question 1 above) Correct?

Yes.

> 3. In the event of a failure of a node in a cluster, messages may be 
> lost, but do they still obey the strict ordering, even though messages 
> may travel a different route in the cluster?

At the minute queues in a RabbitMQ cluster are located on a node; so, if
the node was lost, the queue would be lost, and the ordering moot.

> 4. I’m assuming that the ordering semantics guaranteed per-channel, correct?

The spirit of the ordering guarantee is more like "along a single route,
ordering between a single publisher and a single consumer is preserved".

Generally, the other consistency guarantees in AMQP 0-8/0-9-1 are scoped
to channels, though.

> 5.Can a subscriber determine a unique ID of the actual sender (i.e., can 
> a subscriber know if a message was sent by A or B)?

One can use, for example, the message header "correlation-id" to label
messages from a particular publisher -- the broker won't touch it.

Regards,
Michael





More information about the rabbitmq-discuss mailing list