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