其他分享
首页 > 其他分享> > SpringCloud Gateway的组成结构

SpringCloud Gateway的组成结构

作者:互联网

SpringCloud Gateway的底层基于Netty,主要组成有Predicates(谓词或者断言)、Route(路由)、Filter(过滤器)
思维导图----------SpringCloud Gateway的组成:

路由(route):网关的基本构建块。它由ID,目标URI,谓词集合和过滤器集合定义
过滤器(Filter):这些过滤器是使用特定工厂构造的Spring FrameworkGatewayFilter实例
谓词(Predicates): 引用了java8的函数谓词,输入类型是Spring FrameworkServerWebExchange。谓词可以匹配HTTP请求中的所有内容,例如标头或参数

在gateway中配置uri配置有三种方式,包括
第一种:ws(websocket)方式: uri: ws://localhost:9000
第二种:http方式: uri: http://localhost:8130/
第三种:lb(注册中心中服务名字)方式: uri: lb://brilliance-consumer

能被gateway的lb方式识别到的命名规则为:

 "[a-zA-Z]([a-zA-Z]|\\d|\\+|\\.|-)*:.*"

标签:lb,SpringCloud,uri,谓词,过滤器,Gateway,组成
来源: https://www.cnblogs.com/revol/p/15735822.html