Search code examples
spring-cloudhystrixnetflixspring-cloud-netflix

application.yml not picked up by hystrix


i want to move the below configuration in the method annotation to property file

@HystrixCommand(commandProperties = {
            @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "10000"),
            @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "10000"),
            @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "5"),
            @HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "100")   
    },
            fallbackMethod = "fallbackCall")

I have places the application.yml file under src/main/resources

hystrix:
  command.:
    getResult:
      circuitBreaker:
        sleepWindowInMilliseconds: 10000
        errorThresholdPercentage: 100
        requestVolumeThreshold: 5
      metrics:
        rollingStats:
          timeInMilliseconds: 10000

I am not using spring boot. This file is not getting picked up by Hystrix.

Is there any configuration need to be done to pass the application.yml to hystrix configuration ?


Solution

  • created as config.properties and it worked . This is by default looked up by archaius

    hystrix.command.getResult.metrics.rollingStats.timeInMilliseconds=10000
    hystrix.command.getResult.circuitBreaker.requestVolumeThreshold=5
    hystrix.command.getResult.circuitBreaker.errorThresholdPercentage=100
    hystrix.command.getResult.circuitBreaker.sleepWindowInMilliseconds=10000