2

Our current system is a legacy system which doesn't use domain events. We are going to start publishing domain events. Other bounded contexts are going to listen to these domain events, but only from the time we start publishing, losing all the past information.

Then, how to deal with this legacy system which didn't record these events, but somehow we want to have a past history before the implementation of this event store system?

Is it a good approach trying to figure out what happened and try to create the domain events (reverse engineering) according to the data we have in our DB?

4

1 回答 1

8

我不会尝试对遗留系统的事件进行逆向工程,除非有商业理由这样做- 你的用例是否只是你想适应你将使用的建模事物的新方式事件?如果没有商业案例,这听起来像是在浪费精力。

有一个单一的开始事件来代表你的每个“事物”的当前状态(即,如果你使用 DDD 概念,则为聚合),因为它们现在存在于遗留系统中?然后在此之上添加新事件。

IE

LegacySystemStateCaptured

新域事件

另一个新领域事件

...然后当您重建状态时,应用 LegacySystemStateCaptured 事件以及其他事件。

于 2016-08-02T18:46:34.083 回答