知识卡片
提交后发送仍可能丢事件
先提交聚合、后发布事件仍有故障窗口:数据库提交成功后,进程崩溃或总线不可用,事件就可能永远没发出。调整两次独立写入的先后顺序无法提供原子性,需要先把待发事件与业务状态一起持久化,使后续发布可恢复。
相关:[[先发事件会暴露未提交状态]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 通信模式 · 查看原书依据
Perhaps the message bus is down. Or the server running the code fails right after committing the database transaction, but before publishing the events the system will still end in an inconsistent state, which means that the database transaction is committed, but the domain events will never be published. These edge cases can be addressed
参考来源
- 位置:《Learning Domain-Driven Design》第9章《通信模式》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch09.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:Perhaps the message bus is down. Or the server running the code fails right after committing the database transaction, but before publishing the events the system will still end in an inconsistent state, which means that the database transaction is committed, but the domain events will never be published. These edge cases can be addressed