How it works · The durable outbox

Write the consequence down, then carry it out

A state change that must cause something elsewhere does not do it directly. It writes the new state and a command row in one local transaction; dispatchers carry the rows out afterwards. A crash cannot lose a consequence, a retry cannot repeat one, and no distributed transaction is needed.

The durable outbox: a state change and its next task, committed together A process enters a new state. Instead of starting a worker directly, it writes the new state and a START_WORKER row in one local database transaction. Dispatcher replicas poll the outbox; one claims the row with a lease and a claim token, finds its command through the registry, carries out the effect with a receipt and acknowledges the row in the same transaction. Variants show a replica dying mid-dispatch, with another taking over after the lease, and a command that keeps failing, backs off, goes dead and is replayed. one local database transaction state changeprocess P-1 → EXECUTING command producerwhich consequences? process_tableUPDATE state INSERT outbox rowON CONFLICT DO NOTHING chenile_process_outbox START_WORKER · key P-1:EXECUTOR status: (no row yet) attempt 0 no claim retry 1 s, 2 s, 4 s… ≤ 60 s · 5 tries dispatcher · Apoll · SKIP LOCKED dispatcher · Bpoll · SKIP LOCKED command registrySTART_WORKER → StartWorkerCommand topicWorkListenerInput receiptsWORKER P-1:EXECUTOR operatordeadCount · replayDead(id) publish is at least once: receivers dedupe on dispatchId
scenario
view
Step 1

Exchange

Payload

No XA

The state and the command that acts on it commit in the same database transaction. The broker is only involved later, when the command runs.

One owner, fenced

SKIP LOCKED gives each row to one replica; a claim token and a lease fence out a replica that paused or died. Effects and the acknowledgement commit together.

Never forever

Failures back off from 1 second to a minute, then the row is dead and visible. Replay keeps its identity and receipts, so nothing that already happened happens again.