How is a compensating action different from a rollback?
Sketch your own answer first, then compare it with the one below.
A strong answer
A rollback erases a change as if it never happened. No one saw it. A compensation is a new, committed change that cancels the effect of an old one. A refund does not remove the charge. It adds a credit.
So the earlier change was visible, and anything that reacted to it may have done so. Some actions cannot be compensated at all, such as sending an email. Put those at the end, after the steps that can fail.
Sources
- Hector Garcia-Molina, Kenneth Salem (1987). Sagas.
- Chris Richardson (2018). Pattern: Saga.