Track 4 · Messaging and Correctness
Transactional Outbox
Saving to your database and telling the broker are two separate writes, and one of them will eventually fail alone. The outbox turns "tell the broker" into a row that commits with your data, so the event can be late but never lost.
Guide20 min read1 interactive
On this page
- The customer who paid and got nothing
- The simple version
- The dual-write problem
- The fix: write the event in the same transaction
- The polling publisher
- Duplicates are normal, so make the consumer safe
- Ordering: the part that surprises people
- CDC: let the database log be the relay
- Housekeeping: the outbox grows forever if you let it
- Failure, poison messages and schema changes
- Watch the lag
- See it happen
- When to use it, and when not to