Sagas and Distributed Consistency

Module:Core concept

A saga coordinates local transactions across systems that cannot share an atomic transaction.

How to apply it

Define durable step state, idempotency, timeout, retry, compensation, and operator recovery. Compensation is a business action: a payment may require a refund, while an email cannot be unsent. Expose pending states honestly.

Worked example

Provisioning creates a workspace, allocates resources, configures a provider, and sends an invite; failed provider setup triggers retry or documented compensation.

Common mistakes to avoid

Reporting success before critical work completes or assuming every side effect can be rolled back.

Practice task

Implement this concept in the capstone. Add one positive test, one negative or failure-path test, and a short note explaining the trade-off you chose.

Key Takeaways
  • A saga coordinates local transactions across systems that cannot share an atomic transaction.
  • Define durable step state, idempotency, timeout, retry, compensation, and operator recovery.
Knowledge Check

What is the strongest production practice for Sagas and Distributed Consistency?