Skip to catalogue

108

transactional outbox

Write the row and the “please publish this event” in the same database transaction. A worker publishes after.

What is transactional outbox?

The outbox pattern avoids the dual write: you commit business data and an outbox row together. A separate process reads the outbox and publishes to the queue, then marks it sent. Crash between commit and publish no longer loses the event.

Why does transactional outbox matter when vibe coding?

Models commit the order, then await the queue. The process dies in the gap. The order exists and nobody is told. Name the outbox or that gap stays.

How do you do transactional outbox?

Same transaction: domain write plus outbox insert. Publisher is idempotent. Consumers are idempotent. Do not publish inside the database transaction.

How do you ask a model for transactional outbox?

Use a transactional outbox for (event). Insert it in the same transaction as the (row). A worker publishes after commit. Do not call the broker inside the transaction. Consumers must be idempotent.

What goes wrong with transactional outbox?

An outbox nobody polls. The table grows and the event never leaves. The worker is part of the design, not a follow-up.

adjacent