知识卡片
客户端绑定消息结构
消息中心客户端依据媒体类型处理链接、条目、表单和错误;业务动作名称及调用细节从响应取得。它绑定的是稳定的消息规则,而非某个服务的函数目录。
例如客户端保留renderControls与handleClicks,服务新增截止日期动作后,通用渲染器可呈现新表单;无需新增一个同名客户端函数。这个收益依赖服务提供结构化超媒体以及客户端真正理解控制,不能从普通JSON自动推出新动作的业务含义。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体客户端 · 查看原书依据
A great way to build resilient client applications is to code your client app to bind tightly to the message returned by the service, not to a particular service or domain problem. That way, if there are minor changes in the service, as long as the media type response stays the same, your client application is likely to continue to operate correctly.
参考来源
- 位置:《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.3)
- 结论依据:原文对比领域动作函数与通用消息处理函数,解释新增表单为何可由既有客户端呈现。
- 原始内容:A great way to build resilient client applications is to code your client app to bind tightly to the message returned by the service, not to a particular service or domain problem. That way, if there are minor changes in the service, as long as the media type response stays the same, your client application is likely to continue to operate correctly.