Protocols
Saved & recent

Transactional outbox

Also called: outbox pattern, transactional messaging outbox

The transactional outbox pattern coordinates a database change with a message that must eventually be published. The application writes both its business data and an outbox record in one database transaction. A separate relay later publishes the committed outbox record. This avoids the gap where a database commit succeeds but the corresponding direct message send fails.

For example, confirming a ticket reservation also inserts a “reservation confirmed” event in the same transaction. A relay publishes that event after commit and retries after outages. If it publishes and crashes before recording progress, it may publish again. Consumers therefore need duplicate handling; the pattern alone does not guarantee exactly-once effects across the database, broker and downstream services.

Related
Delivery semantics, Idempotency key, Message broker
Further reading
AWS Prescriptive Guidance — Transactional outbox pattern
one database transaction update reservation insert outbox event E17 after commit relay E17 first send E17 retry broker deduplication check consumer retry after publish crash
The reservation and outbox event commit together in one local database transaction. A later relay publish can repeat E7 after a crash, so consumers need duplicate handling. The database transaction does not include the later publish.

View in the full Protocols collection