I’m currently experiencing some unexpected behaviour related to aggregate snapshotting. I’d like to clarify whether my expectations are wrong or if the behaviour is due to a bug.
I’m using the EventCountSnapshotTriggerDefinition to control when aggregate snapshots are created. This is working fine and snapshots are being triggered when required. However, when the AggregateSnapshotter constructs the snapshot event it publishes the last event twice. For example, if the event count threshold is set to 100 then the snapshotter will publish event 99 twice. In most cases this is not an issue. However, there are some events in my current implementation for which the handling is not idempotent and this is creating aggregates with an invalid state. So, my questions are:
- is this the expected behaviour when constructing aggregate snapshots?
- Is it mandatory that event handling be idempotent within an aggregate root?