/
Event Sourcing Pattern

Event Sourcing Pattern

Problem

  • CRUD operations have limitations : slow down performance and responsiveness.

  • Data update conflicts in a collaborative domain.

  • Needs auditing mechanism that records details of each operation.

 

Solution

  • An event store acts as a system of record about the current state of the data.

  • An event store could be combined with the CQRS pattern.

image-20240812-175331.png
  1. User issues a command to do an action (ex. to reserve a seat)

  2. Data aggregate (Seat availability) is pouplated by querying for reservation & cancellation events.

  3. The command invokes a method in the domain model to do action (reserve or cancel).

  4. The data aggregate records an event staging (ex. number of seats that were reserved).

  5. System appends the event to the event store.

Event Sourcing in Practice

Examples : Event Sourcing (martinfowler.com)