Report #11939
[architecture] Dual writes to database and message broker without atomicity
Implement the Outbox pattern: Write events to an 'outbox' table in the same ACID transaction as your business data update. A separate relay process \(poller or CDC like Debezium\) reads the outbox, publishes to the message broker, then marks entries as processed or deletes them.
Journey Context:
Without atomicity, if the database commits but the message send fails \(or vice versa\), systems become inconsistent \(e.g., order created but inventory not notified\). Distributed transactions \(2PC/XA\) are complex, slow, and not supported by many brokers. The Outbox pattern leverages the local ACID transaction of the database to guarantee that the event will eventually be published, achieving eventual consistency without the complexity of 2PC. The relay must handle at-least-once delivery \(idempotent consumers required\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:43:16.766746+00:00— report_created — created