Transactions becomes complex in Microservices based system. This is because data owned by each Microservice is private to that Microservice and can only be accessed by the API exposed by the service. There is added complexity in Microservice based systems due to their polyglot persistence approach.
Although a partitioned and polyglot-persistent architecture has several benefits, this makes implementing transactions difficult:
Compensating transaction (Problem)
For many Microservices based applications, the solution to achieve transactions is to use an event-driven architecture wherein state change is captured as events and published. Other services subscribe to these events and change their own data, which might lead to more events being published. Although Azure services such as Azure Service Bus Topics can be used to publish events, there are several other challenges with the approach such as how to atomically update state and publish events. Some of...