知识卡片
状态观察由客户端定目标
当最终目标只由客户端掌握时,服务需要按客户端选择提供状态反馈。
状态观察让客户端决定目标状态,服务只提供可观察变量与可调用动作。例如楼层控温程序选择温度传感器及恒温器,而照明程序选择运动传感器及灯开关,二者复用同一服务。
先获取可观察项,再创建每个消费者独有的选择资源,后续响应包含其选中值,直到更新或清空。相比长查询参数,独立选择资源便于复用,但双方须记住并传递URL,也要按身份限制可见项。书中watch相关关系与偏好是应用约定。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体工作流 · 查看原书依据
The ideal situation is to have each client request only the data properties it is interested in monitoring and only returning the action elements (FORMS) that each application wants to access. Client applications need a way to tell the service what information it wants to see for each HTTP request response.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第7章《超媒体工作流》§7.13(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch07.xhtml)
- 结论依据:原文以状态观察让客户端决定目标状态,服务只提供可观察变量与可调用动作的方式说明该用途;同节示例与讨论补充了卡内条件和边界。
- 原始内容:The ideal situation is to have each client request only the data properties it is interested in monitoring and only returning the action elements (FORMS) that each application wants to access. Client applications need a way to tell the service what information it wants to see for each HTTP request response.