Skip to main content

Distributed Transaction Patterns

View Markdown

Distributed transactions span multiple services that each own their own data, with no shared database transaction to roll back. These patterns coordinate the steps, undo completed work when a later step fails, and keep external side effects correct under retries.

Patterns in this section

Choosing a pattern

You need to undo completed steps when a later step fails: use the Saga Pattern and define a compensation for every step that has an external effect.

You need to respond to the caller before the transaction finishes: use Early Return to acknowledge after initialization and continue processing in the background.