zuul核心流程图
2021-12-28 16:29:41 0 举报
zuul核心流程图
作者其他创作
大纲/内容
(sType = route)
释放资源RequestContext从ThreadLocal中移除
eureka-serverserviceB -> 192.168.162.1:10002192.168.162.3:10003
HttpServletRequestHttpServletResponse
ZuulRunnerbufferRequests = false
error过滤器
setZuulEngineRan
eureka-clientserviceB -> 192.168.162.1:10002192.168.162.3:10003
将路由规则放置到RequestContext中
FilterProcessor#runFilters
根据sType获取过滤器并执行过滤器,重写compareTo根据filterOrder升序排序
Servlet30WrapperFilter将RequestContext的request = Servlet30RequestWrapper
AbstractRibbonCommand#run
init
HttpServlet
SendResponseFilter
创建HttpClientRibbonCommand
DebugFilter默认不执行,当请求中debug = true时才执行
ZuulServlet
PreDecorationFilter当没有forward.to和serviceId时执行获得请求uri:/serviceB/sayA
execute本质就是HystrixCommand
ServletDetectionFilterServlet30WrapperFilterFormBodyWrapperFilterDebugFilterPreDecorationFilter
将响应写出到浏览器
设置response头信息
继承实现service方法
RibbonRoutingFilterSimpleHostRoutingFilterSendForwardFilter
(sType = pre)
RequestContextHttpServletRequestWrapperHttpServletResponseWrapper这个是使用ThreadLocal存储
pre过滤器
post过滤器
ILoadBalancer#chooseServer
执行异常
用户
RibbonRoutingFilter
zuulEngineRan = true
根据请求url到application.yml中匹配route
请求
Hystrix的超时、熔断、降级、资源隔离
获取pre过滤器
获取route过滤器
支撑
route过滤器
FormBodyWrapperFilter默认不执行,当MediaType为APPLICATION_FORM_URLENCODED或MULTIPART_FORM_DATA才执行
ServletDetectionFilter将RequestContext的isDispatcherServletRequest = true
返回
创建RibbonCommandContext
继承
初始化
程序启动
ZoneAwareLoadBalancer
SendForwardFilter默认不执行
获取post过滤器
将response封装到RequestContext中
SimpleHostRoutingFilter默认不执行
RibbonLoadBalancingHttpClientILoadBalancer
0 条评论
回复 删除
下一页