Event Sourcing Pattern — Distributed Design Patterns

Most systems that we work with on a general basis, require the latest state of the system and we use CRUD operations to keep the system at it’s latest state. However, there are systems that require temporality, which means your system doesn’t just need the latest state, but also can need the state at a particular point in time or needs to rebuild a new state/parallel system from its past states.

Event Sourcing

Event Sourcing is a pattern that suggests storing the history of all changes made to an application’s data as a sequence of events. Rather than storing the current state of the data, Event Sourcing stores the sequence of events that led to that state. In other words, instead of storing the result of each operation, we store the operation itself.

Event Sourcing

How does Event Sourcing Work

Event Sourcing is based on the idea that every change to the data should be recorded as an event. These events are stored in an event store, which is a database specifically designed to store events.

When an operation is performed on the data, instead of updating the current state of the data in the database, an event is created that describes the operation. This event is then stored in the event store.

--

--

Pratik Pandey - https://pratikpandey.substack.com
Pratik Pandey - https://pratikpandey.substack.com

Written by Pratik Pandey - https://pratikpandey.substack.com

Senior Engineer with experience in designing and architecting large scale distributed systems.

No responses yet