I have spring boot infrastructure with few microservices. They communicating pretty well between each other. One of the microservices have some third party calls, calling some third party services through http. I have defined my own RestTemplate and in the init() method I am setting connectTimeout and readTimeout. From the stack traces I see that my rest template is used.
@PostConstruct
public void init() {
HttpComponentsClientHttpRequestFactory requestFactory =
new HttpComponentsClientHttpRequestFactory();
requestFactory.setConnectTimeout(connectTimeout);
requestFactory.setReadTimeout(readTimeout);
this.restTemplate = new RestTemplate(requestFactory);
}
The problem is that some of the requests are handing for few minutes and no exceptions are thrown. (my timeouts are much less - about 5-10 seconds) What may be the cause? Any ideas?