The Outbox Pattern
Talk it through out loud with your AI coach.
The problem
- hard
- Pro
When an order is placed, your code saves it to the database and then publishes an order placed message to a queue. Sometimes the save succeeds but the publish fails, and the warehouse never hears about the order. Explain the outbox pattern and how it fixes this.
What a strong answer covers
- Why saving data and publishing a message can't be made atomic directly.
- Recording the message in the same transaction as the business data.
- A separate process that delivers recorded messages.
- What delivery guarantee results and what consumers must handle.
Common mistake: Publishing first and saving second, which simply swaps one failure for the other.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud