Nepxion/DiscoveryGuide

zuul 使用线程池隔离时,RequestContext 上下文会丢失

jackorjack opened this issue · 5 comments

30L0X159CHF@5P3 KALON

在获取com.nepxion.discovery.plugin.strategy.zuul.context.ZuulStrategyContextHolder#getZuulRequestHeaders 中RequestContext 中 getZuulRequestHeaders 头的信息时,获取不到值,debug会发现,filter中 RequestContext 对象 和这里获取的 RequestContext 地址已经不是同一个地址,导致获取不到head中的版本信息,不能按规则去路由

    <!-- 当Zuul用Hystrix做线程隔离的时候,才需要导入下面的包 -->
    <!-- <dependency>
        <groupId>com.nepxion</groupId>
        <artifactId>discovery-plugin-strategy-starter-hystrix</artifactId>
        <version>${discovery.version}</version>
    </dependency> -->

这个有依赖,spring.application.strategy. hystrix.threadlocal.supported=true也配置了

n-d-version从界面传入了么?

没有,只是实现了ZuulStrategyRouteFilter 重写了getRouteVersion 方法

微信 1394997