我想在业余时间学习事件溯源(使用 Greg Youngs Event Store)。我已经设置了一个简单的流,我可以从中读取和写入。
请参阅此链接:https ://eventstore.org/docs/getting-started/?tabs=tabid-1%2Ctabid-dotnet-client%2Ctabid-dotnet-client-connect%2Ctabid-4 。它说:
“如果您对领域模型进行事件溯源,则流等同于聚合函数。”
我不相信我以前曾经遇到过聚合函数这个术语——我知道聚合根和聚合,但不知道聚合函数。假设我有以下事件:
BookingCreatedEvent
BookingUpdatedEvent
如果我要在 SQL Server 中创建一个事件日志,那么它可能看起来像这样(Cargo 列包含序列化对象):
为此,我在 Event Store 中有哪些事件流?我在这里阅读了一位似乎对事件溯源非常了解的用户的回答,他提出了以下建议:
AggregateType+AggregateId+Version
在此基础上,相信这些事件将被命名如下:
BookingCreatedEvent511 (51 is the aggregate ID and 1 is the version)
BookingUpdatedEvent511 (51 is the aggregate ID and 1 is the version)
BookingUpdatedEvent512 (51 is the aggregate ID and 2 is the version)
BookingCreatedEvent521 (52 is the aggregate ID and 1 is the version)
BookingUpdatedEvent513 (51 is the aggregate ID and 3 is the version)
BookingCreatedEvent531 (53 is the aggregate ID and 1 is the version)
BookingUpdatedEvent514 (51 is the aggregate ID and 4 is the version)
BookingUpdatedEvent515 (51 is the aggregate ID and 5 is the version)
BookingUpdatedEvent516 (51 is the aggregate ID and 6 is the version)
BookingUpdatedEvent517 (51 is the aggregate ID and 7 is the version)
因此有 10 个事件流。这看起来有点令人困惑,即连接聚合 ID 和版本 - 例如,假设我有以下内容:
BookingUpdatedEvent51745
我怎么知道 51745 的哪一部分是聚合 ID,哪一部分是版本。
我是否正确理解了这一点?