[英]Spring Cloud: How to define default fallback for Hystrix in Zuul gateway?
I am using Spring Cloud Brixton.M3 and Spring Boot 1.3.0.RELEASE. 我正在使用Spring Cloud Brixton.M3和Spring Boot 1.3.0.RELEASE。 I am sort of new in this (especially in Spring Cloud).
我在这方面有点新鲜(特别是在Spring Cloud中)。 I have created Registry Server (ie Eureka instance), Config server and Gateway.
我创建了Registry Server(即Eureka实例),Config服务器和Gateway。
As per my requirement I am intercepting each request hitting the gateway in one of my Filter to extract required information from Header and based upon that I am throwing exception or forwarding / verifying that request using Feign Client
. 根据我的要求,我拦截每个请求到达我的一个过滤器中的网关,以从Header中提取所需信息,并根据我抛出异常或使用
Feign Client
转发/验证该请求。 Some time hystrix throw HystrixRuntimeException
when it couldn't reach out to respective services or because of any other issues. 有些时候hystrix在无法访问相应服务或因任何其他问题时抛出
HystrixRuntimeException
。
So What I want is: 所以我想要的是:
@ControllerAdvice
since I am not providing any custom @HystrixCommand
and Controller to call services (AOP based solution ?). @ControllerAdvice
之外的全局异常处理因为我没有提供任何自定义的@HystrixCommand
和Controller来调用服务(基于AOP的解决方案?)。 TimedOutException
or because of HttpConnectionPool exception ? TimedOutException
或HttpConnectionPool异常? Update 更新
Is it a good practice to provide own routing in Zuul gateway ? 在Zuul网关中提供自己的路由是一种好习惯吗? using
@RestController
and @HystrixCommand
together ? 一起使用
@RestController
和@HystrixCommand
? (I think its a bad idea, because over the period of time we will end up with lots of controllers and hence actual use of intelligent routing wouldn't work as expected) (我认为这是一个坏主意,因为在一段时间内我们最终将会有大量的控制器,因此实际使用智能路由将无法按预期工作)
Currently there is an open issue for fallbacks with feign. 目前存在一个悬而未决的问题 。 There is also an open issue for fallbacks with zuul.
还有一个与zuul回退的公开问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.