Questions tagged [read-model]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
12
votes
3answers
3k views

Rehydrating Aggregates from a “snapshots” projection rather than the Event Store

So I've been flirting with Event Sourcing and CQRS for a while now, though I've never had the opportunity to apply the patterns on a real project. I understand the benefits of separating your read ...
10
votes
2answers
2k views

CQRS without DDD and without (or with?) ES - what is write model and what is read model?

As far as I understand, the big idea behind CQRS is having 2 different data models for handling commands and queries. These are called "write model" and "read model". Let's consider an example of ...
6
votes
3answers
2k views

CQRS and DDD terminology

Since CQRS and DDD do not imply one another I was curious what terms belong to DDD and what terms belong to CQRS. Because the two concepts are so much used together in the literature I usually mix ...
6
votes
1answer
2k views

CQRS-Event Sourcing: how to process events in the expected order inside the read model

I'm looking for some insights about how to handle the read model in a CQRS Event Sourcing application, in order to do the best to ensure data consistency. The missing point is how to be sure (...
6
votes
2answers
2k views

CQRS: How to restore read model

It's very interesting how to restore read model in system based on CQRS. In regular mode system processes commands, creates domain events and posts them to message bus. Then another part of system (...
4
votes
1answer
823 views

Event sourcing – finding aggegate by different property than ID

Is there any mechanism or best practise for finding aggregates by different property than aggregate ID? I'll try to explain my question on example. There is Cart aggregate (event-sourced) and ...
4
votes
2answers
2k views

How do event sourced systems make sure the read model is only updated once?

Currently looking into Event Sourcing in a Microservices architecture and I've found this article. It describes a possible implementation of CQRS and event sourcing. If the logic dealing with updating ...
2
votes
1answer
681 views

CQRS and microservices: passing information from one service to another

We're building two microservices that use CQRS and Event Sourcing: an Order Service and an Inventory Service. When an order is made, the inventory of that item must be decreased by the amount ordered. ...
2
votes
4answers
1k views

CQRS: Query write model

Context: User wants to edit entity details, say user name. Assuming the fact that the Read Model is eventually consistent with the Write Model is it conceptually wrong to query write model in order ...
2
votes
4answers
580 views

Does CQRS need to be fire and forget, If we need to read guarantee after command?

I'm in researching phase of CQRS+ES. Never done in real world yet. But very soon. However what I saw in StackOverflow and projects, CQRS seems to be fire and forget. So what if there is a chain ...
2
votes
3answers
381 views

get aggregate id based on its data in it

I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. I created an post rest API which create new SizeRangeAggregate. ...
2
votes
2answers
732 views

CQRS / DDD + Event Sourcing. Can the ReadModel read itself?

This is a question for those times you are creating the read model by event handlers. The question comes down to : How can a Event Handler draw from other sources of information than what is ...
1
vote
3answers
251 views

Event Sourcing - Reconstituting Aggregate from Wrong Event Stream

I am working on a project to help learn DDD and am trying to do CQRS and Event Sourcing. Code is in C#. For this example, lets say I have 2 aggregates, Customer and Product. My aggregate repository ...
1
vote
1answer
381 views

Loading Aggregate Root from Database with Validations

Here is a similar question Where to validate domain model rules that depend on database content? I am asking this new question because I have more descriptions and I don't want to change the ...
1
vote
1answer
393 views

CQRS / DDD. Domain event and synchronisation with read model

I have a design question in the "field" of CQRS / DDD. I will not explain in depth the domain, but only what's needed. It's a CONTACT domain, so it manages the contact informations of people and ...
1
vote
2answers
234 views

Saga's and Query model transaction ordering

I have the following Ubiquitous language defined by our domain expert: A User can find UserGroups and add himself to it. A user can query a list of UserGroups where he is member of and remove himself ...
0
votes
1answer
1k views

DTO vs. read model

If I understand the concept of read models correctly, then it's just a simple query to return a use case specific data set. But a DTO seems to have the same purpose, but in a more complex way (...
0
votes
1answer
204 views

CQRS, What reasons cause read model update delay? How to prevent user from taking inconsistence data?

I am considering CQRS for building a realtime game server (not gameplay but the economy). For some reasons. Scaling, Event logging, Model changing. However in realtime game when player upgrade, for ...
0
votes
1answer
429 views

DDD - Same ID/Primary Key, different Aggragate Root class per Bounded Context

I am working on understanding DDD and want to see if this idea is sound, if it is common practice, and if there are any pitfalls or unforeseen complications. I want to effectively have one "entity" ...
-1
votes
1answer
485 views

CQRS + Event sourcing - event groups and event propagation

This is my current CQRS use-case setup: Command DTO is received in application layer handler where we map Command DTO to appropriate domain objects if needed, re-hydrate aggregate root from repo and ...