Transactional Outbox
Also known as:
Outbox Pattern
Application Outbox
Definition
The transactional outbox pattern solves the dual-write problem: updating your database and publishing an event must either both happen or neither. It writes the event into an outbox table inside the same database transaction as the business change. A separate relay process then reads the outbox and publishes to the message broker, so an event is published if and only if the transaction committed, without needing two-phase commit.
Popular reads
View All
Payment System Design: Ledger, Idempotency, and Settlement
Jul 18, 2026
The Complete HTMX Guide: From Zero to Production
Dec 22, 2025
How Google manages billions of lines of code in one monorepo
Sep 04, 2026
Cursor Skills: How to Create and Use Agent Skills
Jun 23, 2026
Transactional Outbox Pattern: Never Lose an Event Again
Apr 07, 2026
Flash Sale System Design: Architecture, Scale, and Oversell
May 16, 2026
Key Takeaways
- It fixes the dual-write problem where a crash between the DB commit and the publish leaves the two out of sync.
- The event is inserted in the same local transaction as the data, so they commit atomically.
- A relay (polling or change data capture) publishes outbox rows to the broker after commit.
- Delivery is at-least-once, so consumers must be idempotent receivers.
How It Works
- Within one transaction, write the business change and insert a row into the outbox table.
- Commit the transaction so both succeed or both roll back.
- A relay reads unpublished outbox rows, either by polling or by tailing the write-ahead log with CDC.
- It publishes each event to the broker and marks the outbox row as sent.
Where It Is Used
- Debezium reads the Postgres or MySQL WAL to publish outbox events into Kafka.
- It is the standard way to emit reliable events from a saga step.
- Many microservice stacks use it instead of distributed transactions to integrate a database with a broker.