知识卡片
发件箱同事务保存待发事件
Outbox把业务状态和待发领域事件放入同一个数据库事务,消息中继再读取已提交事件、发布到总线,成功后标记或删除记录。关系库可用两表原子提交;不支持多文档事务时,可将待发列表嵌入聚合记录。故障恢复依靠持久待办,而非内存中的未发列表。
结构图:
flowchart TD
A[业务状态与待发事件] -->|同一原子事务| B[数据库]
B --> C[消息中继读取待发事件]
C --> D[发布消息总线]
D --> E[成功后标记或删除]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 通信模式 · 查看原书依据
The outbox pattern (Figure 9-11) ensures reliable publishing of domain events using the following algorithm: Both the updated aggregate’s state and the new domain events are committed in the same atomic transaction. A message relay fetches newly committed domain events from the database. The relay publishes the domain events to the message bus. Upon successful
参考来源
- 位置:《Learning Domain-Driven Design》第9章《通信模式》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch09.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:The outbox pattern (Figure 9-11) ensures reliable publishing of domain events using the following algorithm: Both the updated aggregate’s state and the new domain events are committed in the same atomic transaction. A message relay fetches newly committed domain events from the database. The relay publishes the domain events to the message bus. Upon successful