HappYness-Project / Happy-EventSourcing

Event sourcing
10 stars 1 forks source link
cqrs ddd-architecture dotnet-core event-sourcing microservices

Eventsourcing implementation for managing Human being's life.

Eventsourcing Happiness project impelmentation

Technologies Used:

Architecture Implemented:

Getting Started.

Need to check if Docker Desktop has been installed. If not, please install to run this application in Dev environment. Also, for the best practice, you will need the latest Visual Studio 2022 and the latest .NET Core SDK.

docker-compose build
docker-compose up -d

Services

Explanation of the Event Sourcing / CQRS pattern.

Event sourcing is a way of capturing/storing an application's state through the history of events(As a sequence of domain events) that have happened already. It provides a single source of truth about what occured in the whole application. Since event means something that has happened so it should be immutable, and they are stored into a dat abase in an append-only.

CQRS (Command and Query Responsibility Segregation)

Event Store Implementation

Write Model and Persistence

Read Model and Projection

Snapshot

Hasn't been updated yet.

Solution

CQRS separates reads and writes into different models, using commands to update data, and queries to read data.

Commands should be task-based, rather than data centric. ("Book hotel room", not "set ReservationStatus to Reserved"). Commands may be placed on a queue for asynchronous processing, rather than being processed synchronously. Queries never modify the database. A query returns a DTO that does not encapsulate any domain knowledge. Most of the complex business logic goes into the write model, which is Commands. In terms of read model, the application is able to avoid complex joins or complex ORM mappings by storing a materialized view in the read database.

Disadvantages

https://medium.com/codex/ddd-command-query-responsibility-segregation-cqrs-a24bfc30a8e2