Announcement Announcement Module
No announcement yet.
Transaction spanning across many objects in the system Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction spanning across many objects in the system

    I am building an application which has the following flow:

    webservice1 --> jmsqueue1 --> mdb1 --> jmsqueue2 --> mdb2 --->...

    webservice1 - receives a SOAP search request, inserts the request into the database, and sends a jms message containing the unique id to jmsqueue1.
    mdb1 - reads from jmsqueue1, does some processing, and sends the jms message containing the unique id to jmsqueue2.
    mdb2 - reads from jmsqueue2, goes to the database to retrieve the search request, and does some kind of processing

    My question is: using Spring AOP or other technologies is it possible to have a transaction spanning across all of the components described aboved, so that if an error occurs on mdb2 then a rollback will occur on jmsqueue2, mdb1, jmsqueue1, webservice1? I'm not sure if what I'm describing is even possible. Does anyone have any suggestions?

    Thanks in advanced!

  • #2
    You can use Spring's transaction API (either programmatically or, preferred, declaratively). However, note that Spring does not provide a transaction monitor implementation but rather allows you to choose an existing one.

    So in your case you have to ensure to choose a transaction manager that supports distributed transaction. If you use JtaTransactionManager inside an application server you would be just fine (ensure to use XA datasources for database access).