Not choosing the right consistency and concurrency
As we have gathered, it is important to choose the right consistency and concurrency approach when handling distributed transactions.
A distributed transaction saga pattern can be used to manage distributed transactions across services or boundaries and maintain consistency across these boundaries. A saga is made up of an ordered sequence of transactions, whether they are updates, deletes, or inserts. If one of these transactions fails, the saga is responsible for rolling back any of the changes made. This process is referred to as a compensating transaction, which nullifies any previous transactions to return the system to the correct state.
Figure 5.9 shows a high-level view of a saga and its encapsulated responsibilities:
Each transaction happens in isolation locally in each microservice. Each microservice changes the state of its respective data via a command...