知识卡片
状态传递三种接口
一个服务被外部客户端纳入更大流程时,需要让状态可以跨独立服务传递,而不把调用者锁在专属会话中。
服务要能参与外部组合,应尽量接受完整输入、完成动作、返回结果,避免要求预先建立专属会话。小状态直接填接收方表单;大而复杂的集合可用importState/exportState;共享可访问资源也能按引用传递。后两者需提前约定数据形状、格式和词汇。文件上传表单与传递URL指针不同,不能因示例并列就混同机制。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体接口设计 · 查看原书依据
There are three ways you can enable state transfer between services: Pass by value using inline existing FORMS Pass by value using dedicated operations (e.g., importState and exportState) Pass by reference (via a shared URL) using dedicated operations or a FORM
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第03章《超媒体接口设计》(来源项目 book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch03.xhtml;小节:3.7)
- 结论依据:原文以服务要能参与外部组合,应尽量接受完整输入、完成动作、返回结果,避免要求预先建立专属会话的机制或场景为依据;同小节余文补充本卡所列条件,按2022年原书语境整理。
- 原始内容:There are three ways you can enable state transfer between services: Pass by value using inline existing FORMS Pass by value using dedicated operations (e.g., importState and exportState) Pass by reference (via a shared URL) using dedicated operations or a FORM