Timeline for CQRS - Passing aggregate root as argument
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 27, 2017 at 16:19 | comment | added | Constantin Galbenu | I don't seem to understand your problem. Anyway, you should create aggregates only to protect business invariants. | |
| Feb 27, 2017 at 15:45 | comment | added | Bojan Vukasovic | Thats the thing. it is persisted if I create AlgorithmCachedResult aggregate. I just wanted to say that I need both - aggreagate and the view at the same time. View and aggregate will be more less the same but that should not be a problem. | |
| Feb 27, 2017 at 15:27 | comment | added | Constantin Galbenu | But you have a stream: the stream of events Phase1Completed and Phase2Completed. That stream is persisted forever in the event store | |
| Feb 27, 2017 at 14:54 | comment | added | Bojan Vukasovic | but what about the need to have it persisted in system. aggregate root data should be persisted, but read models are allowed to always be recreated from event stream. The problem here is that I have no event stream if I don't create AlgorithmCachedResult aggreagate explicitly. And then that means that I would create one more read model that would be 1-1 clone of AlgorithmCachedResult. | |
| Feb 27, 2017 at 14:42 | comment | added | Constantin Galbenu | You can create multiple different read models, one for every need. Also, the access to these readmodels could be made custom. Some users would be permitted to read data and others denied acces. That is the point of readmodels. Every readmodel fullfills a need. I seldom create more readmodels for on one Aggregate. | |
| Feb 27, 2017 at 14:30 | comment | added | Bojan Vukasovic | example is: I have aggregate AlgorithmCachedResult containing array [1,2] -> read model for user should only be [1]. When updating AlgorithmAR I must pass [1,2] - meaning I need read model that contains [1,2] but then this read model would be only used for inner-system works (not display to end user). Also, if read model is removed, I loose history of events. | |
| Feb 27, 2017 at 8:31 | comment | added | Constantin Galbenu | "...so read model does not seem right" - why? | |
| Feb 27, 2017 at 8:25 | comment | added | Bojan Vukasovic | 2nd option is also problematic since I would not want to modify aggregate1 state, since some other user may do something else at the same time and it should not have concurrency exceptions. | |
| Feb 27, 2017 at 8:25 | comment | added | Bojan Vukasovic | The problem with 1st option is that I need to preserve this algorithm cached results (to have history of it) so read model does not seem right. Also, read model should have additional data that would be hidden from the user that is "viewing" it. The only option for this second problem is to make view that is used only by the system. | |
| Feb 27, 2017 at 6:44 | history | answered | Constantin Galbenu | CC BY-SA 3.0 |