知识卡片
整体事务是合并驱动
客户资料和密码分别由两个服务提交时,注册可能留下只有资料而没有密码的半成品。独立服务增强操作授权隔离,却失去一个数据库事务整体回滚的便利。若业务把全部成功或全部失败作为硬要求,合并职责到同一可执行ACID的服务是一种直接方案;不能仅凭同步调用便认为事务恢复原子性。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 服务粒度 · 查看原书依据
If the password service fails during either of these operations, data is left in an inconsistent state, resulting in complex error handling (which is also error prone) to reverse the original profile insert or take other corrective action (see “Transactional Saga Patterns” for the details of eventual consistency and error handling within distributed transactions). Thus, if having a single-unit-of-work ACID transaction is required from a business perspective, these services should be consolidated into a single service, as illustrated in Figure 7-11.
参考来源
- 位置:《Software Architecture: The Hard Parts》第07章《服务粒度》(来源项目:book-sources;源文件:extracted/Software Architecture The Hard Parts Modern Trade-Off Analyses for Distributed Architectures (Neal Ford, Mark Richards, Pramod Sadalage etc.)/_epub-src/OEBPS/ch07.xhtml)
- 结论依据:所引连续原文给出本卡机制或取舍;条件与示例结合本节已读上下文解释。
- 原始内容:If the password service fails during either of these operations, data is left in an inconsistent state, resulting in complex error handling (which is also error prone) to reverse the original profile insert or take other corrective action (see “Transactional Saga Patterns” for the details of eventual consistency and error handling within distributed transactions). Thus, if having a single-unit-of-work ACID transaction is required from a business perspective, these services should be consolidated into a single service, as illustrated in Figure 7-11.