Replaying legacy events

Hi everyone,

Due to a big code refactor a bunch of events are no longer relevant. The most obvious solution would be to simply delete these classes. But the domain_event_entry table has a bunch of records containing these events as a payload.

So what will happen when these events are replayed while the corresponding Java classes do not exist anymore? I would assume an exception at runtime. Which are the alternatives to handle this issue (besides not deleting the Java classes or deleting these records from the domain_event_entry table)

Thanks in advance!
Kind regards,

Hi Roel,

what happens when Axon receives a message it doesn’t have a class for, depends on the situation it happens in. If you’re receiving these events because you’re subscribed (or tracking) as an event handler, these messages are simply ignored. If you don’t have a class for it, you’re probably not interested in them anyway.

However, if Axon encounters an unknown message when initializing an Aggregate instance, it will fail. Unknown events here are too likely to be an error. You can circumvent this problem by defining an upcaster that simply upcasts to an empty placeholder message. Removing messages isn’t recommended, as it may cause problems with sequence numbers if these messages are at the end of the stream.

Hope this helps.