Quick Decision Rule: When Updating an Orders table and publishing an OrderCreated event to Kafka without risking partial failures where one succeeds and the other crashes, choose Write both the Order row and an Outbox event row in the same local ACID DB transaction, then relay asynchronously via CDC/poller.
| Trigger Condition | Updating an Orders table and publishing an OrderCreated event to Kafka without risking partial failures where one succeeds and the other crashes |
|---|---|
| Recommended Choice | Write both the Order row and an Outbox event row in the same local ACID DB transaction, then relay asynchronously via CDC/poller |
| Classic Trap | Direct dual-writes across a database and message broker have no atomic commit; a process crash between the two permanently desynchronizes downstream services. |
| Verification | Audited on 2026-11-23 · Distributed Systems Core · 2026 |
30-SECOND DECISION TRAP CHECK · CONSISTENCY
An order service commits to PostgreSQL and on the next line calls `kafka.produce("order.created")`. During deployments, pods occasionally crash between the two lines, leaving paid orders that never ship. What architectural pattern eliminates this split?
No matter which order you dual-write two independent systems, a crash between them creates silent inconsistency. Writing to an outbox table in the same local DB transaction guarantees atomic capture.
Trap: Never rely on dual-writes across DB + broker; use Transactional Outbox + idempotent consumers.