2

Are messages received on a Websphere MQ topic that you are subscribed to strictly ordered?

In other words, in similar fashion to a queue, given that your connection is maintained are you guaranteed to receive the topic messages in the same order as they were sent?

vikingsteve
  • 38,481
  • 23
  • 112
  • 156

1 Answers1

3

As per JMS specs

JMS defines that messages sent by a session to a destination must be received
in the order in which they were sent. This defines a partial ordering
constraint on a session’s input message stream.

JMS does not define order of message receipt across destinations or across
a destination’s messages sent from multiple sessions. This aspect of a
session’s input message stream order is timing-dependent. It is not under    
application control.

Also

Although clients loosely view the messages they produce within a session
as forming a serial stream of sent messages, the total ordering of this stream
is not significant. The only ordering that is visible to receiving clients is
the order of messages a session sends to a particular destination.
Several things can affect this order like message priority, 
persistent/non persistent etc.

So to answer your question it is not really JMS provider specific what order messages are received. They will be received in the same order they were sent with above information. The order in which messages are delivered to the server however will be constrained by limitations like message priority, persistent/non persistent etc.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • Ok, I just wanted to check this applies to `topic` as well as a `queue`, is that correct? Thanks – vikingsteve Feb 12 '14 at 12:04
  • yes it applies to `Destination` which can be either a `Queue` or a `Topic`. – Aniket Thakur Feb 12 '14 at 12:06
  • In addition to Aniket's comments regarding the spec, the usual WMQ constraints apply. For example, if the messages traverse a QMgr-to-QMgr channel and are of differing priority or persistence, if there are multiple paths the messages can follow, if there are multiple consumers on the queue to which the messages are delivered (because under the covers topics deliver messages to queues, even if the app doesn't see them as queues), if the queue overflows to the DLQ, etc., then they may not arrive in the order sent. The spec alludes to this where it talks about multiple destinations. – T.Rob Feb 13 '14 at 16:19