What are aggregates and how are they used in CQRS (Command-Query-Responsibility-Segregation) and ES (Event-Sourcing)? I'm new to this kind of architecture, and I'd be really happy if someone could please explain this to me. Thanks!
Aggregates in CQRS
Asked Answered
One little search for CQRS and Event Sourcing will anwser your question –
Doralyn
Duplicate question : https://mcmap.net/q/64230/-what-39-s-an-aggregate-root –
Triacid
First I'd like to quote Martin Fowler's blog post on CQRS and note that Aggregates are rather related to Domain Driven Design then to CQRS.
CQRS naturally fits with some other architectural patterns.
- As we move away from a single representation that we interact with via CRUD, we can easily move to a task-based UI.
- Interacting with the command-model naturally falls into commands or events, which meshes well with Event Sourcing.
- Having separate models raises questions about how hard to keep those models consistent, which raises the likelihood of using eventual consistency.
- For many domains, much of the logic is needed when you're updating, so it may make sense to use EagerReadDerivation to simplify your query-side models.
- CQRS is suited to complex domains, the kind that also benefit from Domain-Driven Design.
In terms of Domain-Driven Design Aggregate is a logical group of Entities and Value Objects that are treated as a single unit (OOP, Composition). Aggregate Root is a single one Entity that all others are bound to.
© 2022 - 2024 — McMap. All rights reserved.