Transactional Outbox
A transactional outbox saves a data change and a message record in one local database transaction. A relay sends the saved message after the transaction commits.
local transaction(business row + outbox row) -> relay/CDC -> broker -> idempotent consumerorders✓order_2048outbox✓evt_784local transaction(business row + outbox row) -> relay/CDC -> broker -> idempotent consumerJOBAnother example
Checkout saves order `984` and outbox event `OrderCreated:984` in one transaction. A relay publishes the event later. If it stops after sending but before marking the row, it may send again. The consumer removes the duplicate by event ID.
Main parts
- 01Business data change
- 02Outbox event row
- 03One local transaction
- 04Relay or change stream
- 05Broker publication
- 06Duplicate-safe consumer
Use it when
Use it when a committed database change must reliably lead to a message or event. Keep the outbox in the same transaction and operate the relay as its own reliable process.
Do not use it when
Do not call it one-time delivery or one transaction across services. Plan for repeated events, their order, relay delay, cleanup, and safe duplicate handling.
Name used in code
local transaction(business row + outbox row) -> relay/CDC -> broker -> idempotent consumer Before you ship
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome: Design or review Transactional Outbox for this system while keeping data correct, secure, and easy to operate. User context: Checkout saves order `984` and outbox event `OrderCreated:984` in one transaction. A relay publishes the event later. If it stops after sending but before marking the row, it may send again. The consumer removes the duplicate by event ID. Technical concept or control: Transactional Outbox. Why it fits: Use it when a committed database change must reliably lead to a message or event. Keep the outbox in the same transaction and operate the relay as its own reliable process. Do not use it when: Do not call it one-time delivery or one transaction across services. Plan for repeated events, their order, relay delay, cleanup, and safe duplicate handling. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): No single official standard controls the whole term. Its meaning may change across teams, platforms, or frameworks. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
Check this request
Review the current use of Transactional Outbox. Definition: A transactional outbox saves a data change and a message record in one local database transaction. A relay sends the saved message after the transaction commits. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.