Details
-
Bug
-
Resolution: Done
-
Major
-
JBoss A-MQ 6.2.1
-
None
-
CR1
-
Description
We have been investigating a faulty messaging ordering behaviour for a couple of days, and we finally determined the scenario in which it happens.
It is linked the way A-MQ handles the roll-back of transactions and the redelivery of messages.
Scenario:
1. Consume messages with a prefetch value >0
2. Upon not receiving messages any more in the consumer (prefetch buffer empty, although there are still messages in the queue), the consumer is closed and a new consumer is created with prefetch=0
3. This new "zero-prefetch" consumer consumes some messages
4. This consumer's session rolls back (on purpose)
-> Conceptually, the messages consumed in 3. go back at the head of the queue since the "maximumRedeliveries" is set to e.g. 10
5. The consumer, the session and the connection are properly closed
6. A new connection, session and consumer are created.
-> the first messages this new consumer consumes are not the messages which consumption was rolled-back at step 4. (although they should be).
In essence, this means that there are situations where a single consumer may consume messages in an order which is different from the order created at the time of enqueue.
(Please note that no message priority is used, and that the initialRedeliveryDelay and redeliveryDelay values are set to zero).