VERTX WebClient池

发布于 2025-02-13 12:11:49 字数 497 浏览 0 评论 0原文

我使用VERTX WebClient消耗了3种不同的(主机)API,下面是我使用WebClient的方式,

WebClientOptions options = new WebClientOptions();
    options.setSsl(true);
    options.setMaxPoolSize(50);
    client = WebClient.create(vertx, options);
client.postAbs(url)
      .timeout(10000)
      .sendJsonObject(payLoad)

如何汇总该连接?我检查了WebClient代码(WebClientBase> httprequestimpl> httpContext&gttpclientRequest),但我无法找到在哪里以及如何实现连接池。

基于API主机或所有API的一个客户端创建多个网络电脑是否很好?请分享您的意见。

I am using vertx WebClient to consume 3 different(host) APIs, below is how I use Webclient,

WebClientOptions options = new WebClientOptions();
    options.setSsl(true);
    options.setMaxPoolSize(50);
    client = WebClient.create(vertx, options);
client.postAbs(url)
      .timeout(10000)
      .sendJsonObject(payLoad)

How would the connection be pooled? I checked the WebClient code(WebClientBase>HttpRequestImpl>HttpContext>HttpClientRequest) but I was not able to find where and how connection pooling is implemented.

Is it good to create multiple WebClient based on the API host or one client for all the APIs? Please share your inputs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

念三年u 2025-02-20 12:11:49

最大池大小为每个目的地。

可以在不同目的地使用单个WebClient使用。
如果您需要为每个目的地调整选项,则每个目标都会创建一个客户端。

池实现在于基础httpclient

The max pool size is per destination.

It is fine to use a single WebClient for different destinations.
You would create a client per destination if you needed to tune the options differently for each of them.

The pool implementation lies in the underlying HttpClient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文