users@glassfish.java.net

Re: JMS: Queue-Ordering

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Fri, 09 Mar 2012 11:26:40 +0000

Patrick,

OK. I suspect what may be happening is that when you roll back the transaction, the broker is redelivering message 1.
However messages 2 and 3 are already cached in the client, ready to deliver to your MDB, and are therefore getting
processed first.

It might be worth experimenting with your MDB throwing an exception rather than rolling back the transaction. Then the
message may be redelivered by the client rather than the broker, which would prevent it losing its place in the message
order.

(If message 2 and 3 also roll back the transaction because the shopping cart is not yet created then I would expect
these to be redelivered after message 1, thereby maintaining the correct order.)

I presume you are using GlassFish MQ and the default resource adapter. If you're using anything else please say so.

Nigel