There are cases where one of the resources participating in a transaction cannot be XA / Two-Phase Commit capable. Atomikos does not support committing if there are other XA capable resources in the same transaction.
When using the NonXADataSourceBean, the transaction where its resource gets registered should enlist it as a "Last resource". Upon committing, the participating XA resources should be prepared, then the non-XA resource should be committed, and if that succeeds, the XA resources can be committed as well.
Currently, in the prepare phase, any non-readonly non-XA resource will throw an exception in the prepare phase implemented due to https://github.com/atomikos/transactions-essentials/issues/83 . However, the non-XA resource should not even be involved in the prepare phase by the transaction coordinator.
I found several resources concerning the topic:
Official Documentation:
https://www.atomikos.com/Documentation/NonXaDataSource
This needs some clarifications regarding the fact that Atomikos DOES NOT implement an equivalent to LRC. It does not allow at most one non-XA resource with XA resources in a transaction. If a non-XA resource is needed, NO other resources can participate in the transaction.
In all posts that @GuyPardon wrote about LRC, he warned about that it is unsafe. I assume (since no references were given) he refers to the warning that Bitronix also wrote in the documentation. I think, that tradeoff is something that an informed user can deal with. So please, at least provide the option.
If any help is wanted on the topic, I am glad to be given pointers to the places where changes need to be implemented and topics that need to be taken care of.
If you want, you can take a look at the rudimentary implementation in the linked commits. I assume they violate dozens of invariants or safety considerations, so feel free to constructively critisize them!
There are cases where one of the resources participating in a transaction cannot be XA / Two-Phase Commit capable. Atomikos does not support committing if there are other XA capable resources in the same transaction.
When using the NonXADataSourceBean, the transaction where its resource gets registered should enlist it as a "Last resource". Upon committing, the participating XA resources should be prepared, then the non-XA resource should be committed, and if that succeeds, the XA resources can be committed as well.
Currently, in the prepare phase, any non-readonly non-XA resource will throw an exception in the prepare phase implemented due to https://github.com/atomikos/transactions-essentials/issues/83 . However, the non-XA resource should not even be involved in the prepare phase by the transaction coordinator.
I found several resources concerning the topic:
In all posts that @GuyPardon wrote about LRC, he warned about that it is unsafe. I assume (since no references were given) he refers to the warning that Bitronix also wrote in the documentation. I think, that tradeoff is something that an informed user can deal with. So please, at least provide the option.
If any help is wanted on the topic, I am glad to be given pointers to the places where changes need to be implemented and topics that need to be taken care of.