Spring batch and XA and local transactions

后端 未结 1 1255
-上瘾入骨i
-上瘾入骨i 2021-01-27 02:39

It is possible to have a jobRepository in spring batch to use local transactions but execute particular job steps in distributed XA transaction?

For XA I use Atomicos 3.

1条回答
  •  醉梦人生
    2021-01-27 02:43

    I have used an XA transaction across all 3 of those resources before successfully using Bitronix in unit testing and WebSphere JTA in production. If you have a separate transaction manager for the Batch Database from the rest of your step, you risk the step and batch database being 'out-of-sync' in the event of a failure in either one of the places (batch database or step).

    for example, you may have a successful commit on your step (JMS and DB) and then failure on your batch Database. when you restart your job it will think that a certain step was unsuccessful whilst your underlying execution was. covering all 3 of the resources in the same transaction manager will prevent this.

    0 讨论(0)
提交回复
热议问题