SOLID & Design Patterns Interview Question #121
What is the difference between Event Sourcing and event-driven architecture?
Architectural Patterns, Application Boundaries & Distributed Design Patterns Senior Advanced
Quick Interview Answer
Event Sourcing is a persistence model in which events are the source of truth for state. Event-driven architecture is a communication style in which components publish and react to events.
Detailed Explanation
Event Sourcing is a persistence model in which events are the source of truth for state. Event-driven architecture is a communication style in which components publish and react to events.
An event-driven system can use ordinary relational persistence, and an event-sourced system can publish events to other components. The concepts are related but independent.
Code Example
Event Sourcing:
Event Store -> rebuild aggregate state
Event-Driven:
Publisher -> Event Bus -> Subscribers