Domain-Driven Design (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the difference between Immediate Consistency and Eventual Consistency in DDD?
senior LevelSystem Design
In Simple Words:
- Immediate (Strong) Consistency: Enforced strictly within the boundary of a single Aggregate using database ACID transactions.
- Eventual Consistency: Used across multiple Aggregates or across Bounded Contexts.
- When Aggregate A changes, it publishes a Domain Event.
- A background handler updates Aggregate B moments later.
- Aligns with real-world business: in the physical world, an order is taken immediately, and warehouse inventory is adjusted asynchronously moments later!