Event Sourcing

In this lesson, we'll study event sourcing.

We'll cover the following

An architecture’s focus on events can also entail other advantages.

  • The state each microservice has in its database is the result of the events it has received. The state of a microservice can be restored by resending all events it has received so far.

  • The microservice can even change its internal domain model and then process the events again to rebuild its database with the new version of the domain model. This facilitates database schema migration.

  • Thus, each microservice can have its own domain model according to the bounded context pattern, but all microservices are still connected by the events they send to each other.

  • An overall state of the system no longer exists, but when all events are saved and can be retrieved, the state of each microservice can be reconstructed.

These ideas form the basis for event sourcing.

Get hands-on with 1400+ tech skills courses.