Snapshots and Event revisions - what happens when upcasted event changes the aggregate state

Hello everyone,

I think that Event revisions and Snapshots are both awesome features of the Axon Framework.
However, I don’t quite get how these two features support each other.

Saying that I have a new event revision that adds a field for example. What happens now if that “extended” event influences now the aggregate state (and that aggregate has already a snapshots).
With a snapshots the old state of the aggregate will be saved, so the aggregate state loaded from the snapshot would not be the same as if all events (included upcased ones) would be used to create it.
Am I missing something here or this is simply a thing to consider when using both snapshots and event up-casting?

Thanks in advance…


I think you need to delete the snapshots in this case, more info in this disscussion:!msg/axonframework/tyER5kndmn8/OTHdxM7bAwAJ


Hello Ivan, Karim,

Karim is indeed on the right track Ivan.
If you have snapshotted your Aggregate, but the Events an Aggregate is based on have been adjusted, this means your snapshots have become invalid.
In essence, a snapshot already becomes invalid as soon as the Aggregate has changed it’s state/implementation between release too.
Hence, I’d typically suggest to drop the snapshots if you’ve update the Aggregate state.


Note that the @Revision annotation you’d use on Events could also be placed on an Aggregate.
A snapshot is in essence an Event, the payload of the Event is however a serialized Aggregate.

Thus, the @Revision annotation can be utilized to change the ‘payloadRevision’ field of your snapshots.
Doing so could server as an easy means to disregard old revisions of snapshots, granted that you’ve adjusted the format of the aggregate.

That’s interesting Steven,
but in this case I beleive we will need upcaster for the snapshot event right? I just tested it quickly and found that the extra field value is null

Hi Karim,

In the absence of the @Revision annotation, the ‘payloadRevision’ field will by default be null.

Thus, if that column is null/empty, you can assume the annotation has not be uset, yet.

You could upcast Snapshot Events if you want, but it is far easier to just drop the snapshots and let the framework recreate them for you.
Thus, I’d personally suggest to take the route of dropping your old snapshots in this case.