.NET Architecture & System Design Interview Question #88
What is Event Sourcing in system architecture?
Transactions, CQRS, Event Sourcing & Distributed Consistency Mid-Level Intermediate
Quick Interview Answer
Event Sourcing stores a sequence of state-changing events as the authoritative history instead of storing only the latest state. An aggregate's current state can be reconstructed by replaying its events.
Detailed Explanation
Event Sourcing stores a sequence of state-changing events as the authoritative history instead of storing only the latest state. An aggregate's current state can be reconstructed by replaying its events.
It can provide auditability and temporal history, but it introduces event versioning, replay, projection, storage, debugging, and operational complexity. It is most appropriate when those capabilities justify the cost.
Code Example
OrderCreated
ItemAdded
PaymentReceived
OrderShipped
|
v
Replay -> current Order state