Closed khannedy closed 7 years ago
Can you show us your configuration?
hi, i have the same problem so, if i can, i'll use this thread
these is my client configuration:
@FeignClient(
name = "serpClient",
path = "/api/v1/serp",
url = "${serp.endpoint:http://localhost:23000}",
configuration = { SerpClientConfig.class })
public interface SerpClient {
@RequestMapping("/{country}/search")
public ResponseEntity<SerpResponse> search(SerpQuery query);
@RequestMapping("/{country}/search")
public ResponseEntity<SerpResponse> count(SerpQuery query);
}
with this options:
@Configuration
public class SerpClientConfig {
@Bean
public Options options() {
return new Options(100,2500);
}
@Bean
public ErrorDecoder errorDecoder() {
return new ClientErrorResponseErrorDecoder();
}
@Bean
public Client client() {
return new feign.okhttp.OkHttpClient(new OkHttpClient.Builder().connectionPool(
new ConnectionPool(30, 5, TimeUnit.MINUTES))
.build());
}
}
My application.yml is this one:
feign:
hystrix:
enabled: true
okhttp:
enabled: true
Is mandatory to define hystrix default timeout configuration is not read from client config?
In this case it is Hystrix timing out not the HTTP client timing out. You can enable disable Hystrix when using Feign, or adjust the Hystrix timeout value using hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
.
Yes, is what i've done, i was wondering if there is a way to instrument both feign timeout and hystrix timeout with the same property because i have three different clients in my service all of them with hystrix and i wasn't able to find a way to set a "per client" hystrix timeout config
i wasn't able to find a way to set a "per client" hystrix timeout config
If you replace default
in hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
with the hystrix client name you can configure timeouts on a per client basis. However this wont effect the Feign client timeout.
Hi
Sorry if i keep bothering you :(
I've just upgraded my spring-cloud-netflix using Dalston.RELEASE and i'm trying to configure hystrix as per client as mentioned before.
my client is configured my client like this:
@FeignClient(
name = "myclient",
path = "/api/v1/something",
url = "${myclient.endpoint:http://localhost:23000}",
configuration = { ClientConfig.class })
public interface MyClient {
@RequestMapping("/{country}/search")
public ResponseEntity<Response> search(@RequestParam("param") String param);
}
and added a configuration in application.yml like this:
hystrix:
command:
myclient:
coreSize: 3
execution:
isolation:
thread:
timeoutInMilliseconds: 1
default:
coreSize: 20
maximumSize: 500
allowMaximumSizeToDivergeFromCoreSize: true
maxQueueSize: 50000
queueSizeRejectionThreshold: 50000
execution:
isolation:
thread:
timeoutInMilliseconds: 1000000
But with this configuration only the default configuration is used in Feign client.
Debugging i've seen that org.springframework.cloud.netflix.feign.HystrixTargeter if no SetterFactor are provided use by default a standard feign.hystrix.SetterFactory. Feign by default (as mentioned here ) instrument Hystrix with a command key that includes the method name (in my case search) so the configuration will be "per single operation" and not " per client" as proof i've changed my configuration changing
hystrix:
myclient: ....
to
hystrix:
"MyClient#search(String)": ...
And, with this new weird command key, Hystrix keep non default configuration : YEE
Right now i've solved my problem by providing a custom SetterFactory but i was wondering if
Thanks again for your patience
@Tera this seems unrelated to the original problem reported in this issue. Please open a separate issue.
My client and @RequestBody like this: @FeignClient(name = "delivery", url = "${client.delivery.url:}") public interface DeliveryClient { @RequestMapping(method = {RequestMethod.POST}, value = {"/order"}) String getDeliveryInfo(@RequestBody DeliveryInfoRequest deliveryInfoRequest); }
public class DeliveryInfoRequest { String orderId; String appCode; String platformCode; } For this sentence "hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds", I try to use "Object" or "DeliveryInfoRequest" or "String,String,String" or "String" to replace "default" . The results are all the same. They do NOT work. The question is how to write below sentence to override default setting. Because upstream API ask me to use this type of request parameters. So please help me. Thanks a lot.
is there anything wrong with my configuration? Feign always timeout after 1 second, even I set timeout to 10 seconds.