spring-bootamazon-dynamodbspring-transactionsdistributed-transactionscockroachdb

Spring rollback transaction from 2 Separate Databases


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?


Solution

  • 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%20Answer&text=CAP%20is%20Consistency%2C%20Availability%2C%20and,throws%20consistency%20out%20the%20window.

    Hope these links can help.