I have this problem in one of my projects.
I have 2 MDBs that work to perform a task.
The 1st MDB runs, inserts some data into database and sends the required reference number to JMS Queue.
The 2nd MDB listens to this JMS Queue, and upon receiving the message, picks it up and starts processing using the database reference numbers.
The 2 phase commit is used using XA conection.
commit is executed only after database insert/update statement is run and message is sent to the queue.
The problem is, the 2nd MDB picks up the message and runs, and it cannot find the data that the 1st MDB has inserted/updated.
It goes to say that JMS Message is posted first and then the database commit happens.
The project requires that the message is sent only after database transactions are done.
Can anybody help?
I am using 2PC, so ideally, message commit and database commit should happen at the same time.