I have a use case where we need to use both MySQL and MongoDB in a distributed transaction i.e. if either of MySQL or MongoDB fails, both MySQL and MongoDB must fail i.e. all the operations done by MongDB and MySQL should get reverted if any of the database fails.
I know about two phase commit protocol or XA transaction and have successfully implemented it with MySQL and zope transaction. But, now I want it to implement with both MongoDB and MySQL.
I have also read about, this question on stackoverflow, but it seems outdated.
With MongoDB 4.2, MongoDB supports distributed transaction between different shards, but is there a way I can use it to implement distributed transaction in MySQL and MongoDb.
I do not want eventual consistency. I am looking for real distributed transaction i.e. unless and until I commit the changes, user should not be able to see the changed data in both MySQL and MongoDB
Preferred language is Python, but if there is way it cannot be implemented in Python but available in other languages it's fine.
Any kind of help will be great. Thanks!