基本概念 路由(Route)是gateway中最基本的组件之一,表示一个具体的路由信息载体。主要定义了下面的几个信息: id:路由标识符,区别于其他Route。 uri:路由指向的目的地uri,即客户端请求最终被转发到的微服务。 order:用于多个Route之间的排序,数值越小排序越靠前,匹配优先级越高。 predicate:断言的作用是进行条件判断,只有断言都返回真,才会真正的执行路由。 filter:过滤器用于修改请求和响应信息。 执行流程 执行流程大体如下: Gateway Client 向 Gateway Server 发送请求; 请求首先会被 HttpWebHandlerAdapter 进行提取组装成网关上下文; 然后网关的上下文会传递到 DispatcherHandler,它负责将请求分发给RoutePredicateHandlerMapping RoutePredicateHandlerMapping 负责路由查找,并根据路由断言判断路由是否可用; 如果断言成功,由FilteringWebHandler创建过滤器链并调用;...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with int
Contact int, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack