← 返回刚才阅读的位置

知识卡片

结构图卡 · 3481.f.1

用目标驱动自动客户端

理解等级:中级

自动客户端需要知道观察什么、可执行什么、期望状态及所处服务环境,对应PAGE的感知、动作、目标、环境。目标不必由服务理解:服务提供状态与可用控制,客户端自行判断。

退出型目标DEG到达条件即停止,例如找到迷宫出口;维持型目标DSG持续检查并调节,例如每15分钟把室温维持在18–22℃。两者都依赖预定规则,并非自动学习或规划。观察值与阈值宜可配置,还须本地掌握超时、异常或告警退出条件,避免依赖故障服务批准自己停止。

关联:[[客户端保存交互状态]]、[[按超媒体控制发请求]]。

结构图:

flowchart TD
 A[读取目标与阈值配置] --> B[观察服务状态]
 B --> C{状态有效且可继续}
 C -->|否| D[本地退出或告警]
 C -->|是| E[比较当前值与目标]
 E --> F{目标类型}
 F -->|退出型且已达成| G[停止]
 F -->|维持型或未达成| H[必要时执行动作]
 H --> B
这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体客户端 · 查看原书依据

      To build client applications that can continue operations until a goal is reached, you need to program some level of autonomy for that client. The application needs to know what property (or properties) to monitor, know the target value(s) for the selected properties, be able to locate and monitor the values over time, and know when an end has been reached and how to effect a stop in processing.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook》第4章《Hypermedia Clients》(来源项目book-sources:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch04.xhtml,配方4.16) - 结论依据:原文定义PAGE及退出型、维持型目标,用迷宫和温控示例说明预定判断与本地逃生条件。 - 原始内容:To build client applications that can continue operations until a goal is reached, you need to program some level of autonomy for that client. The application needs to know what property (or properties) to monitor, know the target value(s) for the selected properties, be able to locate and monitor the values over time, and know when an end has been reached and how to effect a stop in processing.