Reputation: 478
In my Spring Boot application I have a following scenario:
If at any stage an exception occurs, I would like to be sure that the message isn't lost and is placed in the Backout Queue.
Do I need an XA transaction between XA-enabled JMS connection factory and XA-enabled Oracle db driver? Or is it sufficient to use for example DefaultMessageListenerContainer with sessionTransacted flag set to true?
And if the second one is the right answer, what would be a good situation to use XA transaction?
Upvotes: 0
Views: 920
Reputation: 174574
You can avoid XA by using Spring to synchronize the two transactions and coding your app to handle the (small) possibility of a duplicate delivery (when the DB commits but the JMS rolls back due to, say, a lost connection between the DB and JMS commit). I suggest you read the excellent Distributed transactions in Spring, with and without XA by Dave Syer from the Spring team.
If javaworld moves that link sometime in future, google syer xa spring
and you should find it.
Upvotes: 2