-
1. Re: Distributed transaction with different vendors
ochaloup Jan 31, 2019 5:58 AM (in response to alfredopacino)Hi alfredopacino ,
It depends what "synchronize" means for you. There are different transaction models you want to use. Narayana provide ACID for strict consistency and then saga-pattern one (compensating transactions) for case your application withstands the relaxation of the isolation property.
1)
If I start with standard ACID transaction. That's where JTA is used.
I think it could work but there are multiple blind spots. I assume you will need to deeply dive to the implementations to find the way.
First Narayana started to fully integrated with Tomcat from version 9 (see our quickstart and quickstart/dbcp2-and-tomcat at master · jbosstm/quickstart · GitHub and blog Narayana team blog: Narayana JDBC integration for Tomcat and the integration code GitHub - web-servers/narayana-tomcat: Narayana and Tomcat integration ). Here the option is to use DBCP2 library for pooling connecitons.
Before that there was a way to use the IronJacamar JCA for pooling and it will work on Tomcat 7 (see our quickstart quickstart/jca-and-tomcat at master · jbosstm/quickstart · GitHub). But it could need some tweaking from your side.
I'm not aware of some direct integration of Narayana and EclipseLink. We run mainly with Hibernate. Still is should be possible to register two different JPA providers for using Narayana JTA. I expect they would be integrated through the JTA synchronization API.
The issue with MongoDB is that it's not XA aware. Even the MongoDB from version 4.0 (Atomicity and Transactions — MongoDB Manual ) is capable to run transactions (atomic update over multiple documents). MongoDB does not provide the XA for transaction manager could run fully ACID transaction over multiple resources (persistent units in your case). Still you could configure to run MongoDB as last commit resource (LRCO optimization, Narayana team blog: Narayana Commit Markable Resource: a faultless LRCO for JDBC datasources ). That would mean the transaction manager can manage the MySQL with XA and MongoDB as LRCO.
I consider this a challenging integration task. It would be interesting to hear back from you if you run through that successfully.
2)
If you loose a bit your demands for consistency and you are fine with eventual consistent model then saga (Narayana team blog: Sagas and how they differ from two-phase commit ) could be the way to go. The compensation transaction could handle that see presentation here DevNation 2014 - Paul Robinson - Bringing Transactional Guarantees to MongoDB - YouTube and the quickstart here quickstart/compensating-transactions at master · jbosstm/quickstart · GitHub .
Ondra