Transactional Outbox¶
Status: 🟡 Starter note
Problem¶
A service updates its database and must publish an event. A failure between these two operations can create inconsistency.
Core idea¶
Store the business change and an outbound event record in the same database transaction. A separate publisher later delivers the event.
Application
|
+---- Business DB transaction ----+
| |
| Outbox record
| |
+----------------------------------+
|
v
Outbox Publisher
|
v
Event Broker
|
v
Consumers
Important limitation¶
Outbox does not automatically provide exactly-once processing.
Consumers still need to handle duplicate delivery safely.
Architecture questions¶
- What happens if the publisher crashes after publishing?
- How is the outbox cleaned up?
- How do you preserve event ordering?
- How do you scale the publisher?
- What happens when the broker is unavailable?