Generate events from consecutive entity (aggregate?) statuses
Matteo Moci <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAONgFZ6nRveHOrWQbo6QvAfQMOAMzbP=a-b2LBOyng7sUR8AbQ@mail.gmail.com> |
Hi all, I am quite new to ddd and all its related aspects like EventSourcing, CQRS, etc… and lately I discovered this list as really helpful to understand both the basic or subtle and more advanced concepts. Currently, I'd like to have some feedback about the design of a part of a system, since I have lots to learn in this context. The system continuously monitors external entities (aggregates) status: this means that, for example, a job J is launched now and asks for the status of an Aggregate A to another system, and stores its snapshot in an internal repository. Based on the previous snapshot of A in the repository, after storing the current A snapshot, the job J should generate a list of events related to the A status change: for every type of change that A can have, there is a specific type of event that should be produced and sent in the system for further processing. If the A aggregate at time 0 had a field name = "Anna" and at time 1 is name = "Anna F.", the event fired should be something like "entity A changed name to 'Anna F.' at time 1". Storing all the sequence of snapshots of every aggregate provides the system also a way of replaying them, producing again the events that were produced in first instance. This will help also testing, I think. How does that sound to you? Do you have some advice or relevant links to learn from? Thanks! Matteo PS: I pasted a snippet here [1] to illustrate the snapshot repository APIs that I came up with until now. [1] https://gist.github.com/mox601/5646540 -- Matteo Moci http://it.linkedin.com/in/matteomoci http://about.me/matteomoci/bio