Relative Content

Tag Archive for masstransitsaga

Handling Concurrent Requests and Rollbacks in a Microservices Architecture using saga

How should we handle the following scenario? Let’s say we have three microservices. We receive two concurrent requests that update the same records in these microservices. The first request successfully executes and persists in Microservices 1 and 2, but encounters an issue in Microservice 3. Simultaneously, the second request updates the same record in Microservices 1, 2, and 3. Now, Microservice 1 publishes a compensate message to roll back the first request in Microservices 1 and 2. However, during this time, the record in Microservices 1 and 2 has already been updated by the second request. How can we roll back the updated record in Microservices 1 and 2?