知识卡片
网关插件避免承载业务逻辑
网关插件适合认证、过滤、日志等通用入口能力。把业务逻辑搬入插件会让服务与网关共同发布,单个插件变更也可能影响多个团队。入口规则应尽量保持横切职责,业务决策留给拥有该领域的服务。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Many of the use cases realized by these plug-ins are extremely useful, such as authn/z, filtering, and logging. However, it can be tempting to put business logic into these plug-ins, which is a way to highly couple your gateway with your service or application. This leads to a potentially fragile system, where a change in a single plug-in ripples throughout the organization or adds additional friction during release where the target service and plug-in have to be deployed in lockstep.
参考来源
- 位置:《Mastering API Architecture》第3章《API Gateways: Ingress Traffic Management》之《API Gateway as an ESB》(源文件:_epub-src/OEBPS/ch03.xhtml)
- 结论依据:原文明确区分有用的认证、过滤、日志插件与易导致高耦合的业务逻辑插件,并指出同步发布和变更扩散风险。
- 原始内容:Many of the use cases realized by these plug-ins are extremely useful, such as authn/z, filtering, and logging. However, it can be tempting to put business logic into these plug-ins, which is a way to highly couple your gateway with your service or application. This leads to a potentially fragile system, where a change in a single plug-in ripples throughout the organization or adds additional friction during release where the target service and plug-in have to be deployed in lockstep.