Back to Catalog
Microservices
Resilience
Outbox Pattern
Guarantee event delivery by staging events in the DB before the broker — atomicity by design.
Intent & Description
Real-world Use Case
Payment Service processes a charge. Atomically: UPDATE payment_records + INSERT INTO outbox (PaymentProcessed event). Relay sends to SQS. Order Service consumes idempotently. No lost payments, no double-charges, even under load.
Source
📌 TL;DR
Outbox = stage events in your DB, relay to broker. No dual-write, no lost messages. Pair with CDC for near-real-time. The gold standard for reliable event publishing.
Advantages
- Transactional integrity — state change and event are atomic
- Reliable delivery — events survive broker downtime
- Works under load — no silent message loss
- Standard pattern, well-supported by tooling (Debezium, etc.)
Disadvantages
- Additional OUTBOX table in every service’s schema
- Relay/publisher process needs deployment and monitoring
- Adds latency between commit and broker delivery
- Outbox table needs periodic cleanup