Report #82360
[architecture] How to maintain data consistency across microservices without 2PC
Use the Saga pattern with the Outbox pattern: wrap business logic and event insertion in a local ACID transaction to an 'outbox' table in the same database. Use a separate Message Relay process \(CDC or polling publisher\) to read the outbox, publish events to the message bus, and delete or mark entries as processed. Consumers must be idempotent.
Journey Context:
Two-Phase Commit \(2PC\) is blocking, not scalable, and fails under network partitions. Teams often attempt 'dual writes' \(write to DB then send message\), which inevitably creates inconsistency if the process crashes between operations. The Outbox pattern ensures atomicity by treating the message as part of the local transaction. The Saga coordinates the long-lived transaction by chaining compensating actions if a step fails. The common error is forgetting that the Message Relay must handle at-least-once delivery and that consumers must deduplicate or handle duplicate events gracefully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:50:10.506507+00:00— report_created — created