reporting in cqrs - unforeseen stats

247 views Asked by At

I understand that basic stats in the read model can be computed on the fly as events from the domain model are generated. Does this really work for more complicated situations? What happens if new stats are required in the future - do you run past events against the new read model retrospectively? Any feedback related to reporting and cqrs would be very much appreciated.

1

There are 1 answers

1
Kenneth On BEST ANSWER

I suppose you're talking about event sourcing, as CQRS does not necessarily mean you're storing events.

In the case of event sourcing, yes, you can just drop your entire read model and rehydrate it from past events. The idea in event sourcing is that your event stream is the log of everything what happened.

The read model is just a projection of those events. It's possible to change that projection when your insights change (or add projections for that matter). That's one of the great strengths of event sourcing.