简体   繁体   English

reactor-netty HttpClient 的默认读取和连接超时

[英]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 的默认读取和连接超时是多少?

Referring to answer given by one of the devs of reactor-netty , the read default time is 10 seconds.参考reactor-netty的一位开发人员给出的答案,读取默认时间为 10 秒。

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.

相关问题 如何在reactor-netty中配置池连接空闲超时 - how to configure pooled connection idle timeout in reactor-netty 如何使用 reactor-netty TcpClient 链接多个发送和接收操作 - How to chain multiple send and receive operations with reactor-netty TcpClient react-netty:使用保持活动状态的HTTP客户端 - reactor-netty: using keep-alive HTTP client netty 中的每个连接超时 - per connection timeouts in netty 使用 spring HATEOAS 和 spring webflux 功能 Web 框架 (reactor.netty) - Using spring HATEOAS with spring webflux Functional Web Framework (reactor-netty) 在错误状态代码上关闭 Reactor Netty 连接 - Closing Reactor Netty connection on error status codes 如果我必须使用 reactor-netty 调用具有低级 HTTP 客户端的另一个微服务,则在 Micronaut 中进行服务发现 - Service discovery in Micronaut if I have to call another microservice with a low-level HTTP client using reactor-netty 当 HttpClient 订阅时,Reactor Netty 没有得到 HttpServer 响应,仅当 HttpClient 阻塞时 - Reactor Netty not getting an HttpServer response when the HttpClient subscribes, only when HttpClient blocks 如何使用Netty Reactor关闭TcpClient连接? - How can I close a TcpClient connection using Netty Reactor? Spring Webflux 应用程序,无法获取 reactor.netty.http.client* 指标和 reactor.netty.connection.provider* 指标 - Spring Webflux application, unable to get reactor.netty.http.client* metrics and reactor.netty.connection.provider* metrics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM