When should use event sourcing?

When should use event sourcing?

Why Use Event Sourcing

  • Represents how we think. In the real world, people think in events.
  • Generating reports becomes easy. Want to know how many times a user changed their email address?
  • You have a reliable audit log. You can generate an audit log that shows exactly how a system got into a state.

Do you need Event Sourcing?

Event sourcing has several benefits: It solves one of the key problems in implementing an event-driven architecture and makes it possible to reliably publish events whenever state changes. Because it persists events rather than domain objects, it mostly avoids the object‑relational impedance mismatch problem.

What does event mean in Event Sourcing pattern?

Application code sends a series of events that imperatively describe each action that has occurred on the data to the event store, where they’re persisted. Each event represents a set of changes to the data (such as AddedItemToOrder ).

How are append-only stores used in Event Sourcing?

Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects.

How does Event Sourcing help prevent concurrent updates?

Event sourcing can help prevent concurrent updates from causing conflicts because it avoids the requirement to directly update objects in the data store. However, the domain model must still be designed to protect itself from requests that might result in an inconsistent state.

How is Event Sourcing different from change data capture?

Event Sourcing uses its own journal as the source of truth, while Change Data Capture depends on the underlying database transaction log as the source of truth. This difference has major implications on the design and implementation of software which will be presented later in this article.