Skip to content

Disable HystrixCommands For FeignClients By Default #1277

Closed

Description

@ryanjbaxter

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.

Activity

  1. self-assigned this
    on Aug 18, 2016
  2. daniellavoie commented on Aug 18, 2016

    @daniellavoie
    Contributor

    I like the idea that it would be deactivated by default. What would be the condition to activate it ? Classpath detection or property configuration ?

  3. spencergibb commented on Aug 18, 2016

    @spencergibb
    Member

    classpath + property

  4. daniellavoie commented on Aug 18, 2016

    @daniellavoie
    Contributor

    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 ?

  5. spencergibb commented on Aug 18, 2016

    @spencergibb
    Member

    It's currently just classpath.

  6. spencergibb commented on Aug 18, 2016

    @spencergibb
    Member

    So you'll have to set a property

  7. spencergibb commented on Aug 26, 2016

    @spencergibb
    Member

    @ryanjbaxter @dsyer do we want to do this in Camden?

  8. ryanjbaxter commented on Aug 26, 2016

    @ryanjbaxter
    ContributorAuthor

    I think so

  9. ryanjbaxter commented on Feb 23, 2017

    @ryanjbaxter
    ContributorAuthor

    @spencergibb @dsyer I think we should def do this for Dalston, thoughts?

  10. spencergibb commented on Feb 28, 2017

    @spencergibb
    Member

    Sure. Needs to be documented and in the release notes.

  11. added this to the 1.3.0.RC1 milestone on Feb 28, 2017
  12. changed the title [-]Diable HystrixCommands For FeignClients By Default[/-] [+]Disable HystrixCommands For FeignClients By Default[/+] on Feb 28, 2017
  13. 3 remaining items

  14. tarunsapra commented on Jul 17, 2017

    @tarunsapra

    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.

  15. spencergibb commented on Jul 18, 2017

    @spencergibb
    Member

    @tarunsapra are you including spring-cloud-starter-hystrix as a dependency?

  16. tarunsapra commented on Jul 19, 2017

    @tarunsapra

    @spencergibb Yes, I am including the dependency -

            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-hystrix</artifactId>
            </dependency>
    
  17. spencergibb commented on Jul 19, 2017

    @spencergibb
    Member

    That is where @HystrixCommand comes from. There must be something else wrong with your dependencies.

  18. tarunsapra commented on Jul 19, 2017

    @tarunsapra

    These are the dependency and If i don't include "netflix-javanica" then there is no @HystrixCommand annotation on the classpath.

    `

    org.springframework.boot
    spring-boot-starter-parent
    1.5.4.RELEASE

    <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>`
    
  19. spencergibb commented on Jul 19, 2017

    @spencergibb
    Member

    If you can produce a small project that recreates the problem, please open another issue.

  20. qianjinjiayin commented on Jul 21, 2017

    @qianjinjiayin

    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.

  21. cherrishccl commented on Sep 11, 2017

    @cherrishccl

    How to user the Hystrix in Feign? Used version is <spring-cloud.version>Dalston.SR3</spring-cloud.version>

  22. ryanjbaxter commented on Sep 11, 2017

    @ryanjbaxter
    ContributorAuthor

    @CHERRISHGRY please don't ask questions on multiple issues like that.

  23. hanrw commented on Oct 16, 2017

    @hanrw
    Contributor

    +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

    To disable Hystrix in Feign

    feign:
    hystrix:
    enabled: false

    To set thread isolation to SEMAPHORE

    hystrix:
    command:
    default:
    execution:
    isolation:
    strategy: SEMAPHORE

    
    
    
  24. eacdy commented on Oct 16, 2017

    @eacdy
    Contributor

    @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.

  25. chendifan commented on Mar 7, 2018

    @chendifan

    嘻嘻嘻,嘿嘿嘿

  26. deleted a comment from kyo-qin on Mar 13, 2018
  27. locked as resolved and limited conversation to collaborators on Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址