Results 1 to 2 of 2

Thread: Implementing Distributed transactions using Spring

  1. #1
    Join Date
    Feb 2012
    Posts
    8

    Default Implementing Distributed transactions using Spring

    Hello

    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:

    Option-1
    Include DB update and JMS message publishing within one transaction.
    Can someone point me to some sample implementation?

    Option-2
    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?


    Thanks
    Chandru

  2. #2
    Join Date
    Feb 2006
    Location
    Los Angeles, CA
    Posts
    79

    Default

    Hi, you might take a look at this blog for information on how to configure Spring and JTA, complete with samples.


    Quote Originally Posted by cganesan View Post
    Hello

    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:

    Option-1
    Include DB update and JMS message publishing within one transaction.
    Can someone point me to some sample implementation?

    Option-2
    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?


    Thanks
    Chandru
    Josh Long
    Spring Developer Advocate
    SpringSource, a division of VMware

    http://blog.SpringSource.org
    http://www.joshlong.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •