Wondering how to handle evolution of application level events over time

Hi, I am trying to figure out the best way to handle event ‘evolution’ if you will, over the life of my system.

If say I today have this and create thousands of events that look like this:

OrderCreated {

Then at some point we discover that I need some thing additional, and in a new release enhance it to this:

OrderCreated {

So I end up with an event log of two different versions of the same kind persisted events. And my application code mapping of that event is now expecting the new one, with the ordertype, and could potentially fail if say I want to do a replay. How is this typically handled?.

You either

  1. have code that can handle both versions of (serialized) events


  1. Use event upcasting. See: http://www.axonframework.org/docs/2.0/repositories-and-event-stores.html#event-upcasting

I handle it by using protobuff for the message classes and serialization. I then go by the rule of keeping most fields optional and having sane default values for the missing fields.

A good advice is to notice when an event has changed too much and should be a new event type instead.