Mahesh
Mahesh

Reputation: 312

Does JMS Message ID represent the order in which JMS server received Message? Order Delivery of Message

If application is publishing message to TOPIC [JMS provider Tibco] in single thread And receiver also reads message in single thread. Still Experiencing rare out of order delivery to receiver.

Relying on JMS Message ID to verify sequencing of the message delivered to JMS Provider.

Is current design good for in order delivery to receiver ? and reliance on JMS message ID to verify the order in which Message received by JMS provider is correct ?

Upvotes: 1

Views: 571

Answers (3)

Shashi
Shashi

Reputation: 15273

MessageID generated by JMS is expected to be unique. However the logic used by a JMS provider to generate a MessageID could be from a simple incremental of a number to usage of a complex algorithm. You should not assume MessageIDs will be sequential. If your application requires message delivery order, then you can look at using message groups where messages in the group are ordered and you can wait till all messages in group are received before you start processing messages.

Upvotes: 0

Stephen C
Stephen C

Reputation: 719229

@Stephan's answer is correct.

I just want to add that the javadoc states that the message ID is generated when the message is sent, not when it is received. So even if the IDs are sequential, they don't tell you the order of delivery.

Upvotes: 0

Stephan
Stephan

Reputation: 651

According to the Java Doc, the messageId is only specified to be unique. http://docs.oracle.com/javaee/5/api/javax/jms/Message.html#getJMSMessageID()

As it is not stated that it is related to message sequencing, I would suggest that it is not, and would recommend against using it for such purposes.

Upvotes: 1

Related Questions