A snapshot can serialize the current object's state. I'm not exactly
sure what you mean with "normalize changes into the snapshot", but I
don't see a purpose of subscribing to the events the aggregate just
emitted for the sole reason to recreate that very snapshot. (Isn't that
just a normal read model projection then anyways?).
Also, the (database) transaction semantics might differ (depends on the
use case). Snapshots that are taken to increase re-hydration speed can
be stored out of the write transaction after the write transaction
committed, as it's merely a cache (a failed snapshot write will only
cause the next re-hydration to take a bit longer). They can even be
held in memory.
If, however, the snapshot *is* the read model, you'll probably make sure
that either:
1) you save the events and the snapshot in the same transaction, or
2) you make sure that events are sufficiently retried if an error
occurs while updating the snapshot.
Option 2), however, is basically what the "normal" read model is
supposed to be doing, so that renders the whole snapshot-as-read model
approach pointless :-)
In my current project, we are using 1) for "CRUD style" aggregates:
Events are stored in the event table and the snapshot state is stored as
JSON, both in the same database transaction (Postgres). The snapshot is
used for the read.
HTH,
Alex
> --
> You received this message because you are subscribed to the Google
> Groups "DDD/CQRS" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
dddcqrs+u...@googlegroups.com
> <mailto:
dddcqrs+u...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/dddcqrs.
> For more options, visit
https://groups.google.com/d/optout.