Announcement Announcement Module
Collapse
No announcement yet.
Using JTA Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using JTA

    Hi All,

    I need to right approach to implement this requirement. I have to implement a Simple File distribution System. I am constrained to use JMS for file distribution. Now the files need to go to different boxes that would listen for files. There could be many servers participating in this distribution and the whole operation is Atomic i.e. if one box fails to update the existing copy of files then all the boxes rollback.

    I need to implement 2 phase commit as follows:

    - Start Transaction
    o Update box1 files (send over JMS)
    o Box1 sends an response (success or fail)
    o Update box2 files (send over JMS)
    o Box2 sends an response(success or fail)
    - Commit the Transaction if both the Boxes got updated Successfully
    - Else Roll Back

    The Success or Failure at Consumer side is my Business Logic and it is more than reading the message successfully from the Queue. Also the Acknowledgement responses are the Psuedo-Synchronous messages. What I am not clear is this, should I use JTA for this and if so, I need to implement XAResource interface Am I correct? Please let me make it clear, i need to manage global transactions.

    Producer->Queue->Consumer->Queue->Producer is one operation

    Please guide me as how to crack this nut, I am using Spring Framework and ActiveMQ over JMS for my application.

    Thank You.
    Sharath

  • #2
    A couple of issues here...you need to decide what your transaction boundaries are. Is it enough that the file enters the remote queue or does it actually have to hit the disk? Regardless, you should be able to setup a two phase commit transaction without issue using the MQ java drivers in spring.

    Comment

    Working...
    X