Back to Catalog
Microservices
Messaging & Events
Transactional Outbox
Write to DB and publish an event atomically — no dual-write, no lost messages.
Intent & Description
Real-world Use Case
Order Service: BEGIN TRANSACTION → UPDATE orders SET status=‘placed’ → INSERT INTO outbox (type=‘OrderPlaced’, payload=…) → COMMIT. Either both succeed or neither does. Polling Publisher picks up outbox row and pushes to Kafka.
Source
📌 TL;DR
Transactional Outbox = write to DB and guarantee event delivery in one atomic shot. The standard solution to the dual-write problem. Pair with Debezium for best results.
Advantages
- Atomic guarantee — business update and event commit together or not at all
- No distributed transaction needed
- At-least-once delivery guaranteed (outbox row persists until published)
- Works with any relational DB
Disadvantages
- OUTBOX table adds schema complexity
- Need to pair with a publisher (Polling Publisher or CDC)
- Outbox rows need cleanup after publishing
- Slight latency from outbox-to-broker pipeline