Zuul架构图
2021-04-24 15:45:07 0 举报
Zuul架构原理图
作者其他创作
大纲/内容
ThreadLocal.get()获取了一个RequestContext
根据请求路径去拿对应路由
SendForwardFilter(这里没执行)
HttpServletRequest
eureka client a
eureka client b
SimpleHostRoutingFilter(这里没执行)
error过滤器pre、route、postRoute只要有一个环节出错,都会走error过滤器
根据IRule算法选择一台server
RibbonRountingFilter
finally
/eureka-client-b/** -> {ZuulProperties$ZuulRoute@11427} \
RiibonRountingFilter是转发到某个服务SimpleHostRoutingFilter是根据URL发送请求SendForwardFilter是转发到网关的某个接口上
Servlet30WrapperFilter
Gateway eureka client
Servlet30RequestWrapper(包裹request)
preRoute
service
将isDispatcherServletRequest = true设置到请求上下文中
isDispatcherServletRequest
SendResponseFilter
是
初始化
ZuulServlet(core component)
2
AbstractRibbonCommand#run()
RibbonCommandContext
添加响应头,然后以流的形式返回响应
hystrix的熔断、降级、限流、超时、异常
请求执行完毕,销毁 threadLocal.remove();
forward请求
执行请求
response
对请求路径判断,是否是安全的
创建RibbonCommand
AbstractRibbonCommand#execute()(HystrixCommand)
DiscoveryClientRouteLocator
哥们
Route
1
RibbonLoadBalancingHttpClient#executeWithLoadBalancer()
HttpServletResponseWrapper(HttpServletResponse)装饰模式
RequestContext
HttpServletRequest和包装原生HttpServletResponse,并设置到
route
ServletDetectionFilter
PreDecorationFilter
CompositeRouteLocator
postRoute
eureka-server
0 条评论
下一页