We've defined a HTTPClient bean in Spring Boot the following way:
@Configuration
public class HttpClientConfig {
@Bean
HttpClient httpClient() {
return HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
.connectTimeout(Duration.ofSeconds(10))
.build();
}
}
We've been getting intermittent timeouts, both on the request and on the connection itself.
We've troubleshooted the network activity and realised that the server we're contacting as a dynamic ip range, effectively change the address for the particular hostname we're contacting.
Would using a single instance of http client cause that kind of issue happening? Would a custom executor help with this scenario?
There isn't much information online regarding connection pooling or managing a connection (unless it's for apache httpclient)