Commit Ordering with JMS

22 Jul 2015 - 07:14 | Version 3 | | , ,

The Problem

Sometimes the order of commits is important. This mostly happens if you have the following use case:

  1. A receives a message, and uses XA JMS drivers to do so (starting a new transaction with participant no. 1)
  2. A writes stuff to db (participant no. 2)
  3. A sends a JMS message to B, and uses XA JMS drivers to do so (re-using participant no. 1)
  4. A commits the XA transaction

Now participant no. 1 will be committed before participant no. 2, which means that there’s a race condition between when process B consumes the message and when the database transaction has completed.


Use separate jms connection factories for receive/send: this will give 3 participants, and a commit order (for the participants in the XA transaction) as: (1)jms-receive (2) db (3) jms-send.

Contact Us

Atomikos Corporate Headquarters
Hoveniersstraat, 39/1, 2800
Mechelen, Belgium

T +3215613055

Subscribe to our newsletter

Never miss an update

Copyright 2015 Atomikos BVBA