I am looking for a good/simple sample on implementing a distributed transaction spanning 2 transactional resources - Spring JDBC & Spring JMS, using Spring JDBC/JMS template and PlatformTransactionManager. The requirement is to publish a message to the JMS queue only when the db update is successful. I can think of 2 options:
Include DB update and JMS message publishing within one transaction.
Can someone point me to some sample implementation?
Publish the message only after the DB update is committed - outside of the DB transaction. The problem here is what if the message publishing fails?