Skip to content
Ameen Abozaid
Planned lessonMID-031-L02

Sagas

  • Lesson 2 of 8
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

model a process as local transactions plus compensations.

Planned topics

  • A saga is a sequence of local transactions; each publishes the trigger for the next.
  • If a step fails, earlier steps are undone by compensating transactions.
  • Sagas give no isolation: others can see intermediate states (for example stock reserved but unpaid).
  • Some steps cannot be undone (email sent); put those last or make them semantic ("send apology").
  • Each step and compensation must be idempotent (MID-029).
Draft outline details

Demonstration

StepLocal transactionCompensation
1Create order PENDINGMark CANCELLED
2Reserve stockRelease stock
3Authorize paymentVoid authorization
4Confirm ordernone (final)

Check your understanding

Why is a saga not isolated like a database transaction?

Show answer

Intermediate states are committed and visible to others.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.