Data and Consistency
Distributed transactions, sagas, the outbox, deduplication, CQRS, event sourcing and data ownership.
The order management case study shows a saga with a transactional outbox end to end.
Published: Saga Pattern, Transactional Outbox and Inbox and CQRS and Event Sourcing.
Articles
- Saga patternHow to keep data consistent across microservices without distributed transactions: sagas as sequences of local transactions with compensating actions, choreography versus orchestration, designing compensations, pivot and retriable steps, isolation anomalies and countermeasures, and implementing an orchestrated saga in Spring Boot.
- Transactional outbox and inboxSolving the dual-write problem in microservices: why saving to the database and publishing to Kafka separately loses or invents events, the transactional outbox table, polling publishers versus CDC with Debezium, ordering and cleanup, the idempotent inbox for consumers, and a Spring Boot implementation.
- CQRS and event sourcingSeparating the write model from read models (CQRS), storing state as an append-only stream of domain events (event sourcing), how they combine, projections and rebuilding views, snapshots, optimistic concurrency on event streams, schema evolution of events, eventual consistency in the UI, and when not to use either.
Planned topics
These topics are on the roadmap and not written yet. They appear here so you can see the full scope of the section.
- Why distributed transactions are avoided
- Eventual consistency
- Data ownership
- Distributed locking trade-offs