I heard and read a lot about Event Sourcing (ES) but earlier I hadn't had occasion to use it in the real-life system. This year I got this opportunity :) For many years I was working with traditional architectures so ES + CQRS + DDD is like a new world to me. Very refreshing experience! I've already learned a lot but I'm still learning and discovering new things. For example, not so long ago the versioning of events was "mysterious" for me.
In traditional approach based on relational databases if we want to change database model we usually write a migration script. Sometimes it's easier, sometimes it's more difficult but it's nothing strange. In the case of ES the rule cast in stone says NEVER EVER UPDATE AN EVENT.
Ok, but actually why? What should I do instead? Are there any patterns that I should know? What is versioning of events? How to implement that?
The answer for all these and many others questions I found in very good book from Gregory Young i.e. Versioning in an Event Sourced System It's not very long (about 100 pages) and is written in easy to understand way. The best thing is that it's available complete for free.
Firstly, you will learn why you should avoid updating events and what are various approaches to versioning of events. You will read about patterns like: Copy-Replace, Stream-Split, Join-Stream, Copy-Transfor,Versioning Bankrupty... and others. You will learn that versioning of behaviour of the system is a bad idea and what to do when something went really bad... And these are only a few things from this book.
So do not hesitate and simply read it.
*The picture at the beginning of the post comes from own resources and shows a nice dog ;)
0 comments:
Post a Comment