Skip to content
All concepts

Concept

Outbox pattern

The outbox pattern makes saving data and publishing an event about it behave as one step. The service writes the event into an outbox table in the same database transaction as the data, and a separate relay publishes rows from that table. A crash can delay an event, but it can no longer lose one or publish one for data that was never saved.

Watch the order and its event commit together, then the relay publish the event afterwards. A live step from the lesson Outbox pattern (Payments). Timings and counts are illustrative.

Where you'll see it

Sources: Airbnb: Avoiding double payments in a distributed payments system ↗ · Uber: Reliable reprocessing and dead letter queues ↗ · Jay Kreps: The Log ↗ · Report a problem

The definition is in our own words; the sources are those of the lesson Outbox pattern.