As a software project built on an event sourcing architecture evolves, the event schema (or event types) are among the things most likely to change over time.
One of the benefits event sourcing architecture offers is that it's able to "replay all events" and build a current state from old events.
What if I need to change the event schema (event types), by adding or removing an attribute, or by changing the semantics of an attribute? The current service implementation won't be able to process old events, because they use the old schema (they do not contain an attribute, or the semantics have changed).
Any ideas for how to handle this situation?
Solution. The Event Sourcing pattern defines an approach to handling operations on data that's driven by a sequence of events, each of which is recorded in an append-only store.
Event sourcing has several benefits: It solves one of the key problems in implementing an event-driven architecture and makes it possible to reliably publish events whenever state changes. Because it persists events rather than domain objects, it mostly avoids the object‑relational impedance mismatch problem.
CQRS is implemented by a separation of responsibilities between commands and queries, and event sourcing is implemented by using the sequence of events to track changes in data.
This is been the topic of the research that I have been doing in the past 2 years. We found 5 techniques that you can use to handle schema evolution:
This is all summarized in our paper "The Dark Side of Event Sourcing" (https://www.movereem.nl/files/2017SANER-eventsourcing.pdf)
We have also researched surrounding areas:
The last part is not yet public. But you can find slides of a talk I gave yesterday at DDDEurope here: https://speakerdeck.com/overeemm/dddeurope-2018-event-sourcing-after-launch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With