What is event sourcing in microservices?
Answer
Event sourcing stores the state of an entity as an ordered sequence of events rather than as a current snapshot. Instead of a row in a database that gets overwritten with UPDATE, you append an event like OrderPlaced, OrderShipped, OrderCancelled to an append-only event log. The current state is derived by replaying all events. Benefits include a complete audit trail, the ability to replay events to rebuild state or create new projections, and natural integration with event-driven architectures. The challenges are that querying the current state requires projection maintenance, the event schema must be carefully versioned, and the event log can grow very large over time requiring snapshotting strategies.
Previous
What is CQRS (Command Query Responsibility Segregation)?
Next
What is the Circuit Breaker pattern?
More Microservices Architecture Questions
View all →- Intermediate What is event-driven architecture and how does it apply to microservices?
- Intermediate What is the Saga pattern in microservices?
- Intermediate What is CQRS (Command Query Responsibility Segregation)?
- Intermediate What is the Circuit Breaker pattern?
- Intermediate What is the Bulkhead pattern in microservices?