Same Event Applied Twice when Generating Aggregate Snapshot

Hi,

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?

Thanks,
Paul

Hi all,

As a follow up Paul added an issue for this on our tracker (which can be found here).
The problem has been resolved in pull request #1416 which is part of Axon Framework release 4.3.2.
So if you are experiencing the same issue, it’s suggested to update to 4.3.2 or higher.

Cheers,
Steven