Backend systems · failure semantics
Transactional Outbox
Reliability Lab
See why “save the order, then publish an event” can lose messages—and how an outbox trades that failure for recoverable, at-least-once delivery.
● deterministic simulation
Run a failure scenario
Change the write pattern and crash point.
No external services. Each run uses one synthetic order and one crash boundary.
What happened
Naïve dual write · no crash
Orders DBWaiting
Outbox rowNot used by this strategy
Event brokerWaiting
Order committed—
Event intent durable—
Events delivered—
Lost / duplicate—
ReadyChoose a failure point and run the simulation to inspect the outcome.
Dual write
Two independent operations can split: DB success + publish failure loses the event.
Outbox pattern
Commit business data and event intent together; a relay retries delivery, and consumers deduplicate.
Reality check: an outbox does not provide magical exactly-once delivery. Real systems need durable relay state, idempotent consumers, monitoring, and operational recovery.