The hystrix support in FeignClients is a nice to have but there is little indication that it is enabled by default and causes a number of problems. You may not even want circuit breakers in your client but you are getting them just by using Feign. An opt in approach would be more ideal, where the user has to enable Hystrix for their FeignClients in their app.
I like the idea that it would be deactivated by default. What would be the condition to activate it ? Classpath detection or property configuration ?
classpath + property
I mean, If I just have hystrix in my classpath, would it be enough to active it ? Or will I have to also active a property ?
It's currently just classpath.
So you'll have to set a property
@ryanjbaxter @dsyer do we want to do this in Camden?
I think so
@spencergibb @dsyer I think we should def do this for Dalston, thoughts?
Sure. Needs to be documented and in the release notes.
Take a long time to find out why the hystrix is not work.- -!
坑爹
这就尴尬了~还好我找到这里
Hi Guys,
Just wanted a small clarification -
I am using Dalston.SR1 release in my POM.xml and I was unable to find "@HystrixCommand" , is it because of this change which is being discussed here? As I had to add "hystrix-javanica" dependency in the POM to make the annotation work. As in the "Camden.SR5" @HystrixCommand seems to work without explicitly adding "javanica" dependency in the POM.
@tarunsapra are you including spring-cloud-starter-hystrix as a dependency?
@spencergibb Yes, I am including the dependency -
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
That is where @HystrixCommand comes from. There must be something else wrong with your dependencies.
These are the dependency and If i don't include "netflix-javanica" then there is no @HystrixCommand annotation on the classpath.
`
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-javanica</artifactId>
<version>1.5.12</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>`
If you can produce a small project that recreates the problem, please open another issue.
Default value is true in HystrixFeignConfiguration of 1.2.5 version
Default value is false in HystrixFeignConfiguration of 1.3.1 version
feign.hystrix.enabled=true
This can enable it.
Dalston 版本坑太多了
How to user the Hystrix in Feign? Used version is
@CHERRISHGRY please don't ask questions on multiple issues like that.
+1
Docs not updated!!!
http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.5.RELEASE/single/spring-cloud-netflix.html#netflix-hystrix-starter
``
Which means it's should be enable:true as default.
If you need to use ThreadLocal bound variables in your RequestInterceptors you will need to either set the thread isolation strategy for Hystrix to `SEMAPHORE or disable Hystrix in Feign.
application.yml
feign:
hystrix:
enabled: false
hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE
```
@MadeInChina Docs are here: http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.5.RELEASE/single/spring-cloud-netflix.html#spring-cloud-feign-hystrix .
BUT many people havn't notice that.
SO, Maybe you Chinese guys Should keep an eye in my BLOG: http://www.itmuch.com
Since Spring Cloud Edgware will be released in short time, THINGS will change, AGAIN....
I'm PLANNING to write those CHANGES and IMPROVEMENTS in Spring Cloud Edgware.
LIKE:
Spring Cloud Edgware新特性之:解决Eureka中Jersey 1.x版本过旧的问题-不使用Jersey
Spring Cloud Edgware新特性之:如何配置Zuul的Hystrix线程池
Spring Cloud Edgware新特性之:使用配置属性自定义Feign的行为
Spring Cloud Edgware新特性之:Zuul routes端点功能增强
AND SO ON.
嘻嘻嘻,嘿嘿嘿
Most helpful comment
坑爹