Questions tagged [read-model]

23 questions
15
votes
3 answers

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 and write concerns, and I appreciate how Event…
MetaFight
  • 11,549
  • 3
  • 44
  • 75
12
votes
2 answers

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 Twitter application clone. Here are the…
Andrey Agibalov
  • 1,564
  • 2
  • 15
  • 25
10
votes
3 answers

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 them up. I came up with this list of the terms that…
redhead
  • 581
  • 6
  • 15
9
votes
2 answers

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 (call it RM subsystem) processes these messages and…
lomomike
  • 91
  • 1
  • 5
6
votes
1 answer

Reducing the code duplication between read and write application in CQRS

I am building an application and trying to embrace Domain Driven design principles, CQRS and event sourcing. We are having two applications one for reading and another for writing. The write application is using a event store data base. And after it…
6
votes
1 answer

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 (mapping an aggregate for a specific use case). I'm…
Hans
  • 406
  • 1
  • 3
  • 13
6
votes
1 answer

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 (actually not sure, but reasonably sure) that the…
Enrico Massone
  • 683
  • 6
  • 14
6
votes
1 answer

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 Product aggregate. There is a rule that when bussiness…
4
votes
2 answers

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 the read model and creating the events are both…
3
votes
4 answers

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 command which need result from another command. First…
kitta
  • 687
  • 6
  • 19
2
votes
1 answer

ES/CQRS: How to access additional information in projections

I'm developing an event-sourced/CQRS application and do not understand the best strategy to use when building the read model projections when additional domain data is needed. A partial representation of the write model aggregates and events are as…
2
votes
3 answers

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. It follows the CQRS/ES which means it creates…
2
votes
1 answer

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. An order can also be canceled. In that case, the…
Peter
  • 998
  • 8
  • 20
2
votes
1 answer

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" with a globally unique primary key. I want to use…
Entith
  • 338
  • 1
  • 11
2
votes
2 answers

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 contained in the handled event itself to construct a read…
Ludovic C
  • 603
  • 5
  • 9
1
2