Event Upcasting and Snapshots


We would like to upcast an event. I found this documentation about Event-Upcasting:

But I’m not sure how existing Snapshots should be handled.
Do I have to delete them for all events to get really upcasted the way I would like them to be?

Or do I have to upcast the snapshot-event? Are there any examples how this could be done?


Hi Dirk,

The Upcaster interface in Axon allows you to upcast anything, actually.

Thus, Snapshots are a valid thing to upcast.

That said though, it will require you to provide quite some custom components to get this going nicely.

We do view the necessity that all components which deal with messages should be able to have upcasters set.

And personally, I think we should extend this to allow upcasters for Snapshots and Sagas too (although that’s still under discussion).

The pragmatic approach I’d share with you, is to just clear out your snapshot tables if the aggregates have a new format.

If that’s not manageable for you at the moment, you can also add the @Revision annotation to your Aggregate Roots, and supply a snapshotFilter (this is a Predicate) to the EventStorageEngine you’re using.

Ow, and sorry for the late reply! We’ve been tremendously busy here at AxonIQ, in benefit of the framework of course. :slight_smile:

Nonetheless, I hope this helps you out!