question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configure @HystrixCommand passing variables.

See original GitHub issue

Good morning,

I am using Hyxtrix to implement the Circuit Breaker design pattern. I would like to know how to pass the value using a variable or reading from Config Server

    @HystrixCommand(
        commandProperties = {
            @HystrixProperty(
name="execution.isolation.thread.timeoutInMilliseconds", 
value="500")
    })

Idea 1:


    @Value("${system1.timeout}")
    String system1Timeout;

    @HystrixCommand(
        commandProperties = {
            @HystrixProperty(
name="execution.isolation.thread.timeoutInMilliseconds", 
value="system1Timeout")
    })

This idea doesn’t work.

Idea 2:


    @HystrixCommand(
        commandProperties = {
            @HystrixProperty(
name="execution.isolation.thread.timeoutInMilliseconds", 
value="${system1.timeout}")
    })

This idea doesn’t work.

Many thanks in advance.

Juan Antonio

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jabrenacommented, Jul 22, 2016

The idea of issue was, how to configure parameters of a HyxtrixCommand outside of the usage.

I found a way:

hystrix:
  command:
    beanMethodInteractingWithSystem1:
      execution:
        timeout:
          enabled: true
        isolation:     
          thread:
            timeoutInMilliseconds: 20000 
0reactions
cforcecommented, Jul 22, 2016

http://stackoverflow.com/questions/31211685/configuring-hystrix-command-properties-using-application-yaml-in-spring-boot-app

cforce cforce@gmx.de schrieb am Fr., 22. Juli 2016 um 15:05 Uhr:

And what happens if i have two classes with the same name " beanMethodInteractingWithSystem1" ??

Juan Antonio Breña Moral notifications@github.com schrieb am Fr., 22. Juli 2016 um 12:59 Uhr:

The idea of issue was, how to configure parameters of a HyxtrixCommand outside of the usage.

I found a way:

hystrix: command: beanMethodInteractingWithSystem1: execution: timeout: enabled: true isolation: thread: timeoutInMilliseconds: 20000

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spring-cloud/spring-cloud-netflix/issues/1209#issuecomment-234515827, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYARl6wGy7MRXQ2XeCzJ8VUl1A-kLtbks5qYKJ0gaJpZM4JShx- .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hystrix Circuit Breaker — How To Set It Up Properly - Medium
When you apply circuit breaker concept with Hystrix into your source code you should set up appropriate values for these three key parameters:....
Read more >
How to pass data from business method to fallback method ...
Passing input parameters data. Methods annotated with @HystrixCommand and the corresponding fallbackMethod need to have the same method ...
Read more >
The Hystrix Parameters You Actually Need to Tune in Spring ...
Thread Pool Key. By default, hystrix will use the same threadpool for all configured HystrixCommands. This is very rarely what you want, because...
Read more >
HystrixCommand (Hystrix Javadoc 1.5.3)
Fluent interface for arguments to the HystrixCommand constructor. ... Do not create multiple HystrixCommand implementations with the same HystrixCommandKey ...
Read more >
Spring Cloud Netflix
To configure the @HystrixCommand you can use the commandProperties attribute ... in RequestContext , null will be passed as a parameter of choose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found