Description
Trevor Stevens opened SPR-12535 and commented
When using XA Transactions sometimes messages are delivered to the queue before they are committed to the database. We have attempted the following within both TomEE and Wildfly and have been able to reproduce this issue in both. I'm attaching a sample project which should allow others to reproduce this as well.
Expected operation, each step represents a seperate XA transaction.
@Service
send JMSMessage using JMSTemplate- Listener1 within a DefaultMessageListenerContainer uses JPA to persists entity and sends a JMSMessage containing ID of entity using JMSTemplate
- Listener2 within a DefaultMessageListenerContainer attempts to retrieve entity by ID from JPA
My thought was that within an XA transaction both the JPA persist and the JMS send must complete before the transaction can commit successfully. We have been trying to tackle a strange case where after the listener for #2 completes the message from #2 is then delivered to #3 but the ID is not present in the database yet and the entity cannot be retreived.
I'm attaching a snippent from a log showing both a passing and failing case of the above steps. Since we have been unable to find any fault with our configuration and due the intermittent nature of this we can only assume that a bug exists somewhere within Springs handling of XA transactions.
Affects: 3.2.12
Reference URL: https://github.com/jej2003/simple-spring
Attachments:
- XA-failure.txt (6.26 kB)