JMS rollback

后端 未结 2 1613
离开以前
离开以前 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:59

    You can use JMS and JTA (Java Transaction API) together - see here. When doing that, the sending of a JMS message or the consumption of a received message actually happens atomically as part of the transaction commit.

    What does this mean? If the transaction fails or is rolled back, the "sent" message doesn't go out and any "received" messages aren't really consumed. All handled for you by your JMS and JTA provider.

    You need to be using a JMS implementation that supports JTA. Sounds like you're already using transactions, so it might be a matter of doing some configuration to make it happen (waving hand vigorously...).

    I've had experience using this (BEA WebLogic 7 w/ BEA WebLogic Integration). Worked as advertised -- "the outside world" saw no impact of JMS stuff I tried unless the transaction committed successfully.

提交回复
热议问题