Hi,
We have lot of critical issues with regarding "HTTP requests should always have socket and connect timeouts".
For this, I created one common configuration to set time outs in project level and use the same request config across all the clients.
Lets say I call my service "httpService". So below is my code
httpClient = httpClientBuilderFactory.newBuilder().setDefaultRequestConfig(httpService.getRequestConfig()).build();
But this is still showing the same error.
Best regards,
Vijaya Kumar Arumugam
Views
Replies
Total Likes
Hi @vjleo94 ,
The snippet you have shared does not include the timeout configuration. Can you share that code as well.
Also, when you see the critical error it should also point to the class that it comes from, are you using the timeout configs correctly there ?
Regards,
Anupam Patra
Hi @anupampat ,
In the snippet you can see
httpService.getRequestConfig()
In that service method (httpService is my custom service), I am setting the timeouts
@Override
public RequestConfig getRequestConfig() {
return RequestConfig.custom()
.setConnectTimeout(httpServiceConfiguration.connectionTimeout())
.setSocketTimeout(httpServiceConfiguration.socketTimeout()).build();
}
Best regards,
Vijaya Kumar Arumugam
Hi @vjleo94 ,
Hope you may have given some default integer value for connectionTimeout in config class if not you may try.
Or it might that scan is not that intelligent to go to 2-3 level then you may need to directly set the timeout.
Thanks
Hi @MukeshYadav_ ,
The values are set in config. The later seems to be the case. It only seems to scan the first level.This results in redundant code as I have to add in each class.
Yes, has always been there. So, still doesn't work.
Hi @Tethich ,
Don't think its expecting request timeout, as I just tested there is no error for the class where I have created rthe same request config in the class itself.
@vjleo94 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Hi @kautuk_sahni ,
There is no clean solution I found for this now.
Just for the build to be successful, I have added the method to set timeouts in each java class instead of using it from service.
Best regards,
Vijaya Kumar A
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies