知识卡片
代码编排适合稳定流程
简单、变化少且不需定制的流程,可以在一个稳定服务接口后用代码调用其他服务。内部替换税费计算等依赖,不必改变外部承诺。
原书用Promise.all并行调用入职相关服务,前提是任务没有固定先后依赖;依赖链不能靠并行语法抹去。代价是流程变化也要经历编码、测试与部署,变体多时容易出现大量一次性实现。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体工作流 · 查看原书依据
When you have a rather simple workflow solution and/or one that will not change over time and does not support customization, it usually makes sense to describe that workflow solution using source code within a single service interface. That means creating an interface that has all the features of your desired solution and then, behind the interface, using source code to enlist and execute other remote services to complete the work.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第7章《超媒体工作流》§7.3(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch07.xhtml)
- 结论依据:原文以简单、变化少且不需定制的流程,可以在一个稳定服务接口后用代码调用其他服务的方式说明该用途;同节示例与讨论补充了卡内条件和边界。
- 原始内容:When you have a rather simple workflow solution and/or one that will not change over time and does not support customization, it usually makes sense to describe that workflow solution using source code within a single service interface. That means creating an interface that has all the features of your desired solution and then, behind the interface, using source code to enlist and execute other remote services to complete the work.