Q47: What is the transactional outbox pattern?
The outbox pattern solves the dual-write problem where a service must update its database and publish an event. The service writes both the business change and an outbox record in one local database transaction. A separate publisher reads the outbox and sends events to the broker, then marks them published or checkpoints progress. Publication may duplicate events, so consumers still need idempotency; monitor lag and provide replay tools.
Key Takeaways
- Commit business state and outbox event atomically.
- Assume publication duplicates and make consumers idempotent.