Reputation: 1185
I have configured the spring aspect for hystrixcommand and it works fine ( Open and Close circuit )
During my testing , what I observed is that when the circuit is open , the normal flow is still invoked and on the event FAILURE , the fall back is invoked.
What i understand from the documentation is that , when the circuit is open , the normal flow will be checked only once in five seconds ( default ) . I tried manually setting the value to 20 seconds , but still did not work
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "20000")
},
fallbackMethod = "fallbackCall")
Where do i set this configuration ? i do not want the error service to be invoked every time and then go to the fallback.
Upvotes: 0
Views: 4365
Reputation: 1185
The test i was doing had incorrect configuration. In order to SHORT_CIRCUIT , circuitBreaker.requestVolumeThreshold should be met.
The default value was 20 and number of failures in the rolling window was not exceeding 20 in my case . So short circuit never happened. Below is the documentation I got from another stack over flow response
within a timespan of duration
metrics.rollingStats.timeInMilliseconds
, the percentage of actions resulting in a handled exception exceedserrorThresholdPercentage
, provided also that the number of actions through the circuit in the timespan is at leastrequestVolumeThreshold
I set circuitBreaker.requestVolumeThreshold to 1 and it works as expected.
Upvotes: 4