Home > Software engineering >  Spring rollback transaction from 2 Separate Databases
Spring rollback transaction from 2 Separate Databases

Time:12-23

I have a Spring Boot server that collects 2 gRPC microservices - one of them works with the DynamoDB and another CockrachDB database. I need to make sure the commit works fine in both of the DB's and if not need to roll back from both of them.

The issue is if this is successful in the first DB and has an exception into the 2nd, it may not be possible normally to rollback from the 1st DB.

How can I achieve so the commit is either successful or failed in both of the DB's together?

CodePudding user response:

For distributed transaction management frameworks or architectures, you can refer to these links:

  1. https://seata.io/en-us/
  2. https://microservices.io/patterns/data/saga.html
  3. https://medium.com/@dongfuye/the-seven-most-classic-solutions-for-distributed-transaction-management-3f915f331e15
  4. https://dba.stackexchange.com/questions/18435/cap-theorem-vs-base-nosql#:~:text=1 Answer&text=CAP is Consistency, Availability, and,throws consistency out the window.

Hope these links can help.

  • Related