简体   繁体   中英

Distributed database transactions

I am trying to write to 3 different databases: MySQL, Oracle and MongoDB. The requirement is that all 3 databases should be in a consistent state. For eg if the write to MySQL and Oracle succeeded, and mongo failed(eg network failure), then there should be a way to write the failed record back to mongo to keep all 3 records consistent. What's the best way to do this? Should I implement a queue to store failed records and have some background process to read records from the queue and try to write it again to the failed database?

Your best bet would probably be the Java Transaction API (JTA) . I have not personally used it but it seems to be the Java "industry standard" for distributed transactions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM