事件分组的设计模式
我想用事件驱动(或消息驱动)架构来实现现有模型。 一些实体需要触发事件来更新其他实体。
B 类实体依赖于 A 类实体。 因此,当 A 实体发生变化时,我将触发一个事件来让一些 B 实体更新 (多个 A 实体“链接”到一个 B 实体)。
在某些情况下,我需要更新所有 A 实体。这将生成事件。 但大多数这些事件将是“redondant”,因为我将更新每个 B 实体 几次。 我想“分组”或“延迟”这些事件。
对于我的用例来说,有用的设计模式是什么? 我需要对待处理事件进行分组吗? 我需要延迟事件吗? 我需要使事件失效吗?基于时间戳 ?
我正在使用 Python,但任何语言的示例都会受到赞赏。
I would to implement a existing model with an event-driven (or message-driven) architecture.
Some entities need to fire events to update other entities.
For entities of class B depends on entities of class A.
So when an A entity is changing, I will fire an event to let some B entities to update
(several A entities are "linked" to one B entity).
In some case, I need to update all A entities. This will generate events.
But most of those events will be "redondant" because I will update each B entity
several times. I would like to "group" or "delay" those events.
What are the usefull design patterns for my use case ?
Do I need grouping pending events ?
Do I need delaying events ?
Do I need event invalidation ? based on time-stamp ?
I am using Python but examples in any langages will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论