1 of 1 people found this helpful
Narayana 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
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.