1

使用基于Marten的CQRS架构

 1 year ago
source link: https://www.jdon.com/61085
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用基于Marten的CQRS架构

Marten是.NET 事务文档数据库和 PostgreSQL 上的事件存储。

下图是采用Marten的事件源样式,以便在更大的 CQRS 架构样式中保持持久性。粗略地说,所有对系统状态的“写入”都涉及向您的 CQRS 服务发送命令消息,其工作流程如下:

cqrs-workflow-with-marten.png?w=782

在处理命令消息的过程中,我们的命令处理程序(或 HTTP 端点)需要:
  1. 获取表示当前工作流状态的“写入模型”。命令处理程序将使用这个预计的“写入模型”来验证传入的命令,并...
  2. 根据现有状态和传入的命令决定应该发布哪些后续事件来更新系统的状态
  3. 将新活动事件持续到正在进行的 Marten 事件商店
  4. 可能将部分或全部新事件发布到传出传输以异步执行
  5. 处理并发问题,特别是如果其他相关命令很可能同时进入相同的逻辑工作流
详细点击标题

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK