I have a question regarding message ordering following redelivery of a message that failed initial processing. I have read through a number of existing threads but didn't find any that exactly describe our issue.
Our application requires absolute message ordering, that is all messages sent to a destination need to be processed in the same order in which they were sent - regardless of failures that may have occurred in either transmission or processing of the messages.
We are using JBoss 5.0.1 and HornetQ 2.1.0.
The scenario is messages are sent to JMS QueueA on ServerA and then via a HornetQ Core Bridge also on ServerA, they are forwarded to QueueB on ServerB. These messages are sent Transactionally, and are being processed from QueueB by an EJB3 MDB. The MDB pool is limited to a single instance in an attempt to enforce message ordering, that is a single MDB processes each message in the order it was sent.
The problem arises when there is a failure in processing the message via the MDB, which throws an exception causing the Tx to rollback and the MDB to be destroyed by the container. The message will be placed back on the queue, however when there are multiple messages on QueueB the next message to be processed by a newly created MDB instance may not necessarily be the message that has just failed - hence out of order processing.
I have tried using Message Grouping, although the semantics described in the documentation aren't really clear in regards to our situation, i.e. it seems to imply the same semantics as only having a single consumer (MDB) - messages are processed "serially" but doesn't explicitly state ordering. Testing with Message Grouping in place still exhibits the problem.
So essentially the question becomes - When a message is placed back on the queue due to failure, will it be the next message to be processed?
Any other suggestions on how best to achieve these semantics would also be appreciated.