Skip to content

Commit

Permalink
re-adding the web client config (#295)
Browse files Browse the repository at this point in the history
* re-adding the web client config

* adding a max idle time less than the load balancer duration.
  • Loading branch information
GavCookCO authored Apr 22, 2024
1 parent 3c8de13 commit 2708ae1
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.netty.http.client.HttpClient;
import reactor.netty.resources.ConnectionProvider;

import java.time.Duration;

@Configuration
public class WebClientConfig {

@Bean
public WebClient getWebClient() {
return WebClient.builder().build();
final ConnectionProvider provider = ConnectionProvider.builder("fixed")
.maxIdleTime(Duration.ofSeconds(30))
.build();

return WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(HttpClient.create(provider)))
.build();
}
}

0 comments on commit 2708ae1

Please sign in to comment.