Restore | Raw | History | First | Previous | Next | Last | Close

Commit Ordering with JMS

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.

Solution

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.

spacer
Copyright © 2014 Atomikos BVBA. Transaction Management for Extreme Transaction Processing and SOA Environments serving ISV, Commercial, OEM and Open Source Markets
Site map RSS ATOM