Skip to content

Outbox Pattern

Reliable event publishing requires atomically committing both the state change and the intent to publish; writing to a local "outbox" table in the same transaction as the change, then asynchronously publishing from the outbox, ensures events are never lost or duplicated relative to state.

Tension Addressed

Autonomy vs. Coordination (enables reliable cross-service communication without distributed transactions)

Recognizable As

Outbox tables; transactional outbox; change data capture (CDC); event tables; "published" flags; polling publishers; log-based messaging

Canonical Sources

Kleppmann, "Designing Data-Intensive Applications" (2017); Richardson, "Microservices Patterns" (2018); Helland, "Life Beyond Distributed Transactions" (2007)

Transfers To

Event Sourcing (event persistence), Message Queues (reliable publishing), Data Integration (change data capture), Audit Logging (guaranteed capture)

The dual-write problem is insidious: writing to both a database and a message queue can fail between the two writes, causing data and events to diverge. The outbox pattern reduces this to a single atomic write, making the event publication asynchronous but guaranteed.