Saturday, August 4, 2018

Event Sourcing

Reliably publish events whenever state changes by using Event Sourcing. Event Sourcing persists each business entity as a sequence of events, which are replayed to reconstruct the current state. Instead of simply storing the current state of a data object in a database, the application persists each object’s state as a sequence of events. Other services can subscribe to events and update their own state.

Event sourcing has several benefits:

•    It provides a 100% reliable audit log of the changes made to a business entity
•    It makes it possible to implement temporal queries that determine the state of an entity at any point in time.
•    Event sourcing-based business logic consists of loosely coupled business entities that exchange events. This makes it a lot easier to migrate from a monolithic application to a microservices architecture.

Event sourcing also has several drawbacks:

•    The event store is difficult to query due to the need to reconstruct the state of the business entities. That is inefficient. As a result, the application must use Command Query Responsibility Segregation (CQRS) to implement queries.

(source: Event sourcing)

Resources

•    Microservice architecture: Event sourcing

•    Building Microservices with Event Sourcing and CQRS

•    Event Sourcing Pattern (MSDN)

No comments:

Post a Comment