-
Book Overview & Buying
-
Table Of Contents
Microservices Design Patterns in .NET - Second Edition
By :
We began by emphasizing the importance of data consistency in a microservices architecture, where each service typically has its own dedicated database. Traditional ACID transactions become difficult in this setting because a single business operation can span multiple services. The Saga pattern, introduced as a solution to this challenge, splits a larger transaction across multiple local transactions. Each microservice involved handles its step independently and communicates success or failure through events, thus allowing for compensating actions when one of the steps fails.
A key part of the chapter covered the concept of coordination, which can be implemented through either choreography or orchestration. In the choreography approach, each service subscribes to relevant events and publishes new events after it finishes its local transaction. If anything goes wrong, those services that need to roll back listen for failure events and perform local compensations. This...