CQRS,ES:如何知道我们是否必须重新排序/忽略读取端的事件? [英] CQRS,ES: How to know if we have to reorder/ignore events on read side?

查看:86
本文介绍了CQRS,ES:如何知道我们是否必须重新排序/忽略读取端的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的团队目前在CQRS和事件源系统的读取端工作。
我们希望我们的投影仪只能收听所有事件的子集,并且我们希望我们的投影仪具有幂等性,因为事件可以发布多次。
这是我们当前的体系结构:

Me and my team currently work on the read side of a CQRS and event-sourcing system. We want our projectors to be able to listen to only a subset of all events and we want our projectors to be idempotent since an event can be published many times. Here is our current architecture:

由于放映员无法处理所有事件,因此可以知道是否未按照正确的顺序接收事件,或者是否已经接收到事件?我们不能使用序列号,因为序列号与流相关,而不与事件类型相关。

Since a projectionist doesn't handle all events how it can know if an event hasn't been received in the correct order or if an event has already been received? We can't use the sequence number because the sequence number is related to a stream and not an event type.

术语投影仪,投影分类帐和投影机来自本文

The terms "projectionist", "projection ledger" and "projector" comes from this article.

推荐答案


如何知道我们是否必须对读取侧的事件进行重新排序/忽略?

How to know if we have to reorder/ignore events on read side?

总线不是事件顺序的授权者-事件存储区负责。因此,需要知道订单发生什么顺序的放映员应该查询商店,而不是尝试根据公交车上的信息重建原始订单。

The "Bus" is not the authority for order of events - that responsibility lies with the event store. So a projectionist that needs to know what order things happen should query the store, rather than trying to reconstruct the original ordering from the information on the bus.

Greg Young在2014年的讲话多边形数据对此进行了很好的讨论。

Greg Young's 2014 talk Polyglot Data includes a good discussion of this point.

(放映员可能会通过某些API查询事件存储,而不是直接与商店交谈-基于商店中数据的精选原子供稿)。

(The projectionist might query the event store via some API, rather than talking to the store directly - a curated atom feed based on the data in the store).

这篇关于CQRS,ES:如何知道我们是否必须重新排序/忽略读取端的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆