Re: CQRS, Event-Sourcing and Web-Applications
"Thomas Presthus [email protected] [domaindrivendesign]" <[email protected]> Tue, 07 Jul 2015 18:45:29 +0200
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Organization | Erus Encodia AS |
| Message-ID | <[email protected]> |
On 07.07.2015 10:49, Rénald VENANT-VALERY [email protected] [domaindrivendesign] wrote: > As I am reading some CQRS resources, there is a recurrent point I do > not catch. For instance, lets say a client emits a command. This > command is integrated by the domain, so it can refresh its domain > model (DM). On the other hand, the command is persisted in an > Event-Store. That is the most common scenario. You normally don't persist commands. You either persist the resulting state, or the events emitted by the domain in response to the command. > 1) When we say the DM is refreshed, I suppose data is persisted in > the > underlying database (if any). Am I right ? Otherwise, we would deal > with a memory-transient model, which I suppose, would not be a good > thing ? (state is not supposed to remain in memory on server side > outside a client request). Why is it bad to keep state in memory? Less round-trips to the database. It really depends on your usage and requirements, though. We've successfully implemented systems that keep state in memory, and hydrates from the event store upon startup. See your above question with regards to persisting the state - it depends on whether you use event sourcing or not. > 2) If data is persisted, I suppose the read-model that relies on it > is > automatically updated, as each client that requests it generates a > new > state in the application (in case of a Web-Application or a RESTful > architecture) ? You'd usually propagate events or state changes to your read model automatically, yes. > 3) If the command is persisted, does that mean we deal with > Event-Sourcing (by construct when we use CQRS) ? Does Event-Sourcing > invalidate the database update process ? (as if state is > reconstructed > from the Event-Store, maintaining the database seems useless) ? Which database? CQRS gives you freedom to model data storage needs depending on use-case, instead of shoehorning everything into a single, canonical model. > DOES CQRS ONLY APPLY TO MULTI-DATABASES SYSTEMS (WHEN DATA IS > PROPAGATED ON SEPARATE DATABASES), AND, IF IT DEALS WITH > MEMORY-TRANSIENT MODELS, DOES THAT FIT WELL WITH WEB-APPLICATIONS OR > RESTFUL SERVICES ? Why would it apply only to multi-databases? You could e.g. store your events in an event store and keep your read-model in memory. -- Thomas Presthus ------------------------------------ Posted by: Thomas Presthus <[email protected]> ------------------------------------ ------------------------------------ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/domaindrivendesign/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/domaindrivendesign/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/