问题标签 [vertx-httpclient]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1398 浏览

java - NoSuchMethodError io.netty.util.AsciiString.cached

我是 Java 新手,并且已经开始维护使用 Vertx.io 的 Java 编写的现有软件系统。当我调用 Vertx Web 客户端 .get() 方法时,netty 包出现错误。我已经用谷歌搜索了错误,但找不到任何东西。有人可以建议我做错了什么吗?

这是调用代码:

这是一个例外:

0 投票
2 回答
709 浏览

vert.x - 使用 vertx 在 JUNIT 中获取并发 TimeoutException

我正在尝试使用 VertxUnitRunner.class 运行 junit 测试用例。我有 35 个测试用例,每次都会为不同的测试用例获取并发异常。我正在使用 jenkins 在 VM 机器上运行这些测试用例。

有谁知道这个的解决方案?

0 投票
1 回答
670 浏览

java - Vert.x's Future gets null value because handler is fired before the future's complete

I am trying to understand Vert.x framework and I have a task to create HTTP server which will perform simple mathematical computations and a client which will send multiple requests to that server. I need to count the time needed to send all requests and get responses. I managed to create the client, the server and to send requests and retrieve responses, but I have a problem with measuring the time needed to do these operations.

My client verticle has the following start() method:

Operations is an enum with all of the mathematical operations the server can do.

Now, I figured out that I need to set starting time before sending a request to the client and then to set ending time on send() callback. Because operations are asynchronous, the ending time may not be set in the moment of getting it to count difference, so I thought this ending time needs to be Future object. So I added some code:

My understanding is the following: before each request I take the current time in miliseconds and create Future for ending time with a handler that will subtract these times when ending time will appear. Then the request is sent and when a response is received ending time is set, so handler method of the Future is called, times are subtracted and saved to a list of all times from all requests.

But I get NullPointerException in the Future's handler method. It's executing before the call to the server so the value is not present yet. I can't understand why and the official documentation for Vert.x doesn't say exactly how to use this Future feature.

0 投票
0 回答
134 浏览

java - 测试 vertx http 客户端代码的问题

我有一个奇怪的问题是Vertx.io 的扩展 GET 静默失败。当我在junit中运行代码时,它失败了(静默)。代码无法访问网络。我已经在 8080 上启动了本地服务器,但是在测试中运行的代码无法访问,而是静默失败。
这很不方便,更不用说对我来说是新的了,我希望它消失!

0 投票
2 回答
1298 浏览

java - 如何使用任何模拟框架模拟 io.vertx.ext.jdbc.JDBCClient

我想模拟io.vertx.ext.jdbc.JDBCClient对以下verticle代码进行单元测试:

0 投票
1 回答
670 浏览

vert.x - Vertx HTTP 客户端支持缓存

我想知道如何将缓存配置添加到 Vertx http Web 客户端。

使用 Apache http 客户端,我可以轻松设置setCacheConfig

有任何想法吗?

0 投票
1 回答
2413 浏览

http - Vert.x HTTP 客户端创建的连接数超过 MaxPoolSize

我的应用程序中有 8 个垂直。每个 Verticle 都在一个单独的线程上。每个 Verticle 都有一个 WebClient ( Vert.x HTTP 客户端)我将 MaxPoolSize 设置为 10。 WebClientOptions webClientOptions = new WebClientOptions() .setMaxPoolSize(10) 但是当我检查时

在生产主机上,我可以看到每个 IP:Port 有超过 10 个连接。

问题 1:MaxPoolSize 是针对整个应用程序还是针对每个 Verticle 全局的。那么对于 XXXX:Y,我可以从我的应用程序创建 10 个或 80 个连接吗?

问题 2:当我向其 DNS 中具有多个 IP 的主机发送请求时,连接池是按主机还是按 IP?例如 gogo.com 解析为 2 个 IP 地址。我可以创建 10 个到 gogo.com 20 的连接吗?

0 投票
0 回答
723 浏览

java - 在 Vertx Web 中使用压缩 (Gzip) 时缺少“内容长度”标头

我在 REST 应用程序中使用Vertx 3.5.3,该应用程序还使用 Vertx Web StaticHandler处理程序提供静态文件。

我使用自己的 Vertx HttpServer 和这个配置:

这是 Vertx 路由器中的静态处理程序配置:

这就是基本配置。

我的疑问是为什么在激活服务器的压缩(gzip)时,它不会content-length在浏览器中显示标头,而是发送标头Transfer-Encoding: chunked。当我停用服务器的压缩 (gzip) 时,服务器会发送content-length带有文件大小的标头。

第一种情况的图像(javascript文件):

Netty 压缩被激活

以及第二种情况的图像(相同的 javascript 文件):

Netty 压缩已停用

content-length当压缩(gzip)处于活动状态时,有一种方法可以从服务器发送标头吗?

我在 Netty 存储库中找到了这个 PR,所以我假设 Netty 确实允许这种行为,并且 Vertx 没有发送标头。

谢谢。

0 投票
1 回答
1200 浏览

java - Vertx WebClient 下载文件

尝试使用 Vertx WebClient从此url下载文件但不工作。我在这里错过了什么吗?

0 投票
0 回答
638 浏览

reactive-programming - 运行多个实例时的 VertX eventbus.publish

我开始意识到 VertX 会将其事件总线发布 (eventbus.publish) 扇出到所有订阅的所有 verticle 实例。但是,如果我将 eventbus.send 用于特定地址,则该消息将被传递到目标 Verticle 的单个实例。我的要求是能够发布消息并将其传递到所有订阅者 Verticle 的单个实例

简单地说,发布一条消息并确保它被所有订阅者接收,但只有一个给定订阅者的实例。

我可以构建中间组件来处理这个问题,但我正在寻找更多开箱即用的选项来解决这个问题。

PS我在集群模式下也试过这个,每个verticle有一个docker,结果是一样的。