Report #29903
[architecture] How to reliably publish messages to queue without losing data if service crashes after DB commit
Implement Transactional Outbox: write events to dedicated outbox table in same database transaction as business logic; use separate relay process \(polling or CDC\) to publish to message queue; mark published rows or delete them after ACK
Journey Context:
Two-phase commit is too heavy for most apps; 'fire and forget' after commit risks message loss if process crashes between DB commit and queue publish; outbox pattern ensures atomic 'business data \+ event' persistence; polling adds latency \(100-500ms\), CDC \(Debezium\) provides near real-time; must handle duplicate publishes with idempotent consumers
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:34:57.254084+00:00— report_created — created