Hey @radekm … I have a few different thoughts than Tom, so I’m going to put them here…
I trust that we’re assuming things like: the publisher is publishing all messages from the same thread, the publisher and subscriber both only have one connection (Session) to the broker, all messages are being published with the same quality of service (aka Delivery Mode: Direct/Guaranteed), same Class-Of-Service (1,2,3), and same Priority. And assuming no loss (e.g. due to network drop-out for Direct messaging).
With all those assumptions holding true, then #1) yes a subscriber listening to both t1
and t2
will receive messages in order: A, B, C, D. Because the messages arrived in the broker in that order, because the publisher sent them in that order from a single thread on the same TCP connection.
Ordering is guaranteed _across _topics, in the order that the broker received them. In Tom’s explanation above for #1, he’s talking about two different publishers… and yes, in that case there is/could be a race condition as to which messages arrive at the broker first. But still, once the messages arrive at the broker, all consumers with the same set of subscriptions will receive the messages in the exact same order. (given my assumptions above).
BTW, one other assumption I should have made: if using Guaranteed messaging, the pattern is to have queues for the consumer, and subscribed to topics. The publisher still publishes on Topics, but should ensure the DeliveryMode is Persistetnt. In this case, I’m assuming you only have a single queue subscribed to both t1
and t2
. If you had two different queues, then again there could be a race condition as to which messages are received first.
I guess for the #3 question, no there should be no changes to ordering! There might be some change in timing between messages if the broker is being overloaded, and obviously the consumer will be receiving a lot of extra messages on t2
, but the absolute order of A, B, C, D will not change.
@TomF am I missing something in what you’re trying to explain?