This content has been marked as final.
Show 2 replies
-
1. Re: Narayana Commit Order
tomjenkinson Mar 30, 2017 3:46 PM (in response to greenbean)1 of 1 people found this helpfulNarayana itself does support commit ordering. Simple ordering to put one of the XAR as the first to be processed can be done if the XAResource implements the interface jboss-transaction-spi/FirstResource.java at master · jbosstm/jboss-transaction-spi · GitHub for example.
jhalliday wrote an excellent article on this a few years back: Narayana team blog: Messaging/Database race conditions -
2. Re: Narayana Commit Order
mmusgrov Apr 6, 2017 12:37 PM (in response to greenbean)Tom's answer is the definitive one but just to add more detail:
- A non portable solution is to take advantage of a quirk of our implementation in which normal two phase aware resources are prepared/committed in the same order that they were enlisted (so enlist the database resource first). There would also be a risk if we change or make our implementation configurable.
- And an unsafe solution would be to make the database resource one-phase aware only and then take advantage of our Last Resource Commit Optimization (LRCO) which will commit it during the prepare phase. If it fails to commit the JMS resource will be told to abort. I say this approach is risky because LRCO is not transactionally safe. Note also that we do have a safe version of LRCO. called CMR, but it can only be used in more restrictive scenarios.