JMS rollback

后端 未结 2 1620
离开以前
离开以前 2021-02-15 13:35

I have a process which involves sending a JMS message. The process is part of a transaction. If a later part of the transaction fails, a part that is after a previous part that

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-15 13:48

    What you have described is an XA transaction. This allows a transaction to scope across multiple layers i.e. JMS provider, DB or any other EIS. Most containers can be configured to use both non XA and none XA transaction so check your container settings!

    For example if you are using JMS with XA transactions the following is possible.

    Start Transaction
          |
       DB Insert
          |
       Send JMS Msg
          |
       More DB Inserts
          | 
       Commit Transaction  <- Only at this point will the database records be inserted and the JMS message sent.
    

    XA Tranactions are only available in full Java EE containers so XA transactions are not available in Tomcat.

    Good luck!

    Karl

提交回复
热议问题