What is a saga?
Sketch your own answer first, then compare it with the one below.
A strong answer
A saga is a long transaction split into a sequence of local transactions. Each local transaction commits on its own in one service. Each has a compensating action that undoes its effect.
If every step succeeds, the saga is done. If one fails, the compensations of the earlier steps run in reverse order.
The trade-off is that a saga is atomic in the end but not isolated. Other work can see the steps while the saga is running.
Sources
- Hector Garcia-Molina, Kenneth Salem (1987). Sagas.
- Chris Richardson (2018). Pattern: Saga.