Reputation: 3282
I'm having problems getting hystrix timeouts to work. I've created an example project to show this here: https://github.com/stianlagstad/spring-boot-timeout-demo.
In bootstrap.yml
I'm setting a timeout like this:
hystrix:
command:
default:
execution.isolation.thread.timeoutInMilliseconds: 60000
circuitBreaker:
enabled: true
sleepWindowInMilliseconds: 300000
fallback.enabled: false
# My client
MyFeignClient#getPost:
execution.isolation.thread.timeoutInMilliseconds: 1
I expect the result of this to be that hystrix commands should timeout after 60 seconds, except for getPost
in MyFeignClient
which should timeout after 1 millisecond. I'm not seeing that, though. The getPost
method returns an answer every time, and I'm pretty sure it takes longer than one millisecond.
I've also tried to set the timeout manually in a test using ConfigurationManager
, but that doesn't seem to work either: https://github.com/stianlagstad/spring-boot-timeout-demo/blob/master/src/test/java/com/example/TimeoutDemoApplicationTests.java
How can I make the timeouts I'm setting take effect?
Upvotes: 1
Views: 1332
Reputation: 5589
You need to fix your properties in two places.
First, add the below property. From dalston release, feign's hystrix support is optional. You already have hystrix on your classpath, so all you need to do is just adding the below property.
feign:
hystrix:
enabled: true
Second, you specified wrong HystrixCommandKey
for your feign. You need to change your HystrixCommandKey like below.
MyFeignClient#getPost():
You need parentheses after #getPost
.
Upvotes: 4