[英]Default read and connection timeouts for reactor-netty HttpClient
I know that a read and a connection timeouts can be configured in reactor-netty HttpClient, like:我知道可以在 reactor-netty HttpClient 中配置读取和连接超时,例如:
public WebClient xsdWebClient() {
HttpClient httpClient = createHttpClient(config.getConnectionTimeout(), config.getReadTimeout());
return WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(httpClient.followRedirect(true)))
.baseUrl(config.getHost())
.build();
}
private static HttpClient createHttpClient(int connectionTimeout, int readTimeout) {
return HttpClient.create()
.option(
ChannelOption.CONNECT_TIMEOUT_MILLIS,
(int) TimeUnit.SECONDS.toMillis(connectionTimeout))
.doOnConnected(c -> c.addHandlerLast(new ReadTimeoutHandler(readTimeout)));
}
But what are the default read and connection timeouts for reactor-netty HttpClient?但是 reactor-netty HttpClient 的默认读取和连接超时是多少?
I would recommend you to use the response timeout configuration provided by Reactor Netty instead of ReadTimeoutHandler
.我建议您使用 Reactor Netty 提供的响应超时配置而不是
ReadTimeoutHandler
。 You can configure the response timeout either globally on HttpClient
level for all requests or per request.您可以在
HttpClient
级别为所有请求或每个请求全局配置响应超时。 The default values for various timeouts provided by Reactor Netty you can find in the reference documentation .您可以在参考文档中找到 Reactor Netty 提供的各种超时的默认值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.