I have a simple usecase in a Java JMS configuration on Weblogic 11g container (using Spring 3.x framework for Dependency injection, and EJB 2.x for MDBs and declarative transaction management in ejb-jar.xml).
- Read message from a queue-1
- Unmarshall the message into java object
- save the unmarshalled java object into a database table
- send the message (containing object-id from step_3) to the next queue-2
- read the message on queue-2 ( and load the object from database based on its object-id)
My problem is in a lot of cases, on step-5, I find the object-id doesn't exist in the database yet, I throw exception, message loops back and gets re-tried, eventually the object_id shows up in the database and the message on step-5 gets processed successfully.
The workflow covering step 1-4 (implemented in an MDB) has a transaction demarcation done as "REQUIRED" in ejb-jar.xml and the connection factory is XA enabled. That means the workflow (step1-4) has to run in a transaction that gets committed when the message is eventually sent to queue-2 in step4.
Then why does step-5 not find the object-id in the database in a lot of cases. Is there any way I can force this to avoid or reduce the getting this error in step-5.