Outbox Pattern Visualizer
Step through dual-write failures versus the transactional outbox — business data and events committed together, then published asynchronously.
Transactional Outbox Pattern
Compare dual-writes vs the outbox: business row + outbox event in one DB transaction, then async publish.
Outbox keeps DB and events consistent: publish only after commit by polling/CDC. Dual-write can lose or double events when the process crashes between DB and broker.
The Dual-Write Trap
Updating the database and then publishing to Kafka/SQS is not atomic. A crash between the two steps means either a missing event or (with naive retries) a duplicate.
Outbox Fix
- In one DB transaction: write business row + outbox row
- Commit
- Poller or CDC publishes to the broker
- Mark outbox row published
Consumers should still be idempotent — at-least-once delivery is the usual model.
