English 中文(简体)
CQRS event versioning
原标题:

Versioning
If your events changes you would create a new version of that event, and keep the old ones. To keep your domain code form being bloated with handling of all versions of events you would basically introduce a component that converts your events from previous to newer versions, and then apply them on the domain. Remember that events are things that actually happened in your domain so in most cases the information in deprecated events are valuable.

I still haven t found any example of this.

Any help?

最佳回答

There are two main ways to handle event conversions. Both happen during event deserialization :

  1. You can add new classes with version numbers (SomethingHappened, SomethingHappened2, SomethingHappened3). The deserializer will instanciate and populate the class, the pass it to a converter to get the same event in its higher version, here SomethingHappened3. One of the problem is that you ll have to update also event handlers to use the last version of the event. To mitigate this, you can use a convention that SomethingHappened is always the last version. When going to v2, rename SomethingHappened as SomethingHappened1 and create a SomethingHappened that will be the v2. To do that you need to have control on the classes created from serialized event since the serialized class name will not contain the version number, you should store it aside.

  2. Instead keeping every version of the classes in your code, the converter will receive a Document (a tree, like an Xml document or JSon object) and will modify it to provide information needed to build the last version.

All this depends on the control you have on your deserialization pipeline.

问题回答

暂无回答




相关问题
Version numbering basics? [closed]

Suppose I have a web application with some basic functions. I want to market it. So I would like to assign a version number - something like 0.0.1. What I want to know is are there any constraints ...

Versioning problem

people. I hope you can help me. In our development process we have a unix based file server with SFTP access (let’s call it A). This server store a large numer of xslt files we are working on. The ...

ECM - Document Control Management / Versioning and CMS

I anticipate this is going to be a very broad question however I shall endevour to be as concise as possible without divulging too much project critical information. For quite some time I have been ...

How do other development teams approach version numbers?

Our application is quite mature, and thus we are up to version 16. However, this can give the impression that the software is old and out of touch (how many commercial applications are there with a ...

SVN avoid storing passwords in plain text?

Under a bare bones setup for SVN on windows (without using VisualSVN), as per the instructions, the passwords are to be entered in the passwd file. Does SVN provide a way to encrypt or atleast mask ...

热门标签