Architecture

Outbox pattern

To atomically write to DB + publish a message: write to an outbox table in the same DB transaction.


In plain terms

A separate process polls the outbox and publishes. Solves "double-write" — without it, message+DB updates cannot be atomic.

Origin

Chris Richardson formalised the pattern around 2018 as the answer to "I need to atomically write to my DB and publish a message." The DB transaction is the atomic boundary; a separate process polls the outbox table.

Where it shows up in production
  • Debezium + Postgres Postgres logical replication streams the outbox table to Kafka. The most common production implementation.
  • Eventuate Tram Java framework that packages the outbox + change-data-capture pipeline.
Sources & further reading
Found this useful?