Skip to content

Commit 1852094

Browse files
Athira SreekumarAthira Sreekumar
authored andcommitted
chore: Update Vert.x version to 5.0.4
Closes: #376 Signed-off-by: Athira Sreekumar [email protected]
1 parent ec03822 commit 1852094

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<version>1.1.4</version>
1010

1111
<properties>
12-
<vertx.version>4.5.15</vertx.version>
12+
<vertx.version>5.0.4</vertx.version>
1313
<logback.version>1.5.11</logback.version>
14-
<jackson-databind.version>2.16.1</jackson-databind.version>
15-
<junit.version>5.9.2</junit.version>
14+
<jackson-databind.version>2.17.0</jackson-databind.version>
15+
<junit.version>5.10.2</junit.version>
1616
<hamcrest.version>2.2</hamcrest.version>
17-
<maven.surefire.version>3.0.0-M5</maven.surefire.version>
17+
<maven.surefire.version>3.2.5</maven.surefire.version>
1818
</properties>
1919

2020
<dependencyManagement>
@@ -106,8 +106,8 @@
106106
<artifactId>maven-compiler-plugin</artifactId>
107107
<version>3.8.1</version>
108108
<configuration>
109-
<source>1.8</source>
110-
<target>1.8</target>
109+
<source>11</source>
110+
<target>11</target>
111111
</configuration>
112112
</plugin>
113113
<plugin>

src/main/java/kafka/vertx/demo/Main.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.vertx.core.*;
1212
import io.vertx.core.file.FileSystem;
1313
import io.vertx.core.json.JsonObject;
14-
import io.vertx.core.spi.resolver.ResolverProvider;
1514
import org.apache.kafka.common.config.SslConfigs;
1615
import org.slf4j.Logger;
1716
import org.slf4j.LoggerFactory;
@@ -40,7 +39,7 @@ public static void main(String[] args) {
4039
long startTime = currentTimeMillis();
4140

4241
// Set vertx timeout to deal with slow DNS connections
43-
System.setProperty(ResolverProvider.DISABLE_DNS_RESOLVER_PROP_NAME, "true");
42+
System.setProperty("vertx.disableDnsResolver", "true");
4443
Vertx vertx = Vertx.vertx(
4544
new VertxOptions()
4645
.setWarningExceptionTime(10).setWarningExceptionTimeUnit(TimeUnit.SECONDS)
@@ -58,7 +57,7 @@ public static void main(String[] args) {
5857
Future<String> periodicProducerDeployment = vertx.deployVerticle(new PeriodicProducer());
5958
Future<String> webSocketServerDeployment = vertx.deployVerticle(new WebSocketServer());
6059

61-
CompositeFuture.join(periodicProducerDeployment, webSocketServerDeployment)
60+
Future.all(periodicProducerDeployment, webSocketServerDeployment)
6261
.onSuccess(ok -> logger.info("✅ Application started in {}ms", currentTimeMillis() - startTime))
6362
.onFailure(err -> logger.error("❌ Application failed to start", err));
6463
}

src/main/java/kafka/vertx/demo/WebSocketServer.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,12 @@ private Future<HttpServer> createRouterAndStartServer(JsonObject config) {
7575

7676
data.put("config", props);
7777

78-
engine.render(data, "webroot/index.html", res -> {
79-
if (res.succeeded()) {
80-
ctx.response().end(res.result());
81-
} else {
82-
logger.error(res.cause().getMessage());
83-
ctx.fail(res.cause());
84-
}
85-
});
78+
engine.render(data, "webroot/index.html")
79+
.onSuccess(buffer -> ctx.response().end(buffer))
80+
.onFailure(err -> {
81+
logger.error(err.getMessage());
82+
ctx.fail(err);
83+
});
8684
});
8785

8886
return startWebSocket(router);
@@ -106,7 +104,7 @@ private void handleWebSocket(ServerWebSocket webSocket) {
106104
handleConsumeSocket(webSocket);
107105
break;
108106
default:
109-
webSocket.reject();
107+
webSocket.close();
110108
}
111109
}
112110

src/test/java/kafka/vertx/demo/WebSocketServerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ public class WebSocketServerTest {
2525

2626
@BeforeEach
2727
void setup(Vertx vertx, VertxTestContext testContext) {
28-
vertx.deployVerticle(new WebSocketServer(), res -> {
29-
testContext.completeNow();
30-
});
28+
vertx.deployVerticle(new WebSocketServer())
29+
.onComplete(testContext.succeeding(id -> testContext.completeNow()));
3130
}
3231

3332
@Test
@@ -44,7 +43,8 @@ void getTemplateResponse(Vertx vertx, VertxTestContext testContext) {
4443

4544
client.get(8080, "localhost", "/")
4645
.as(BodyCodec.string())
47-
.send(testContext.succeeding(response -> testContext.verify(() -> {
46+
.send()
47+
.onComplete(testContext.succeeding(response -> testContext.verify(() -> {
4848
assertThat(response.body(), CoreMatchers.containsString(EXPECTED));
4949
testContext.completeNow();
5050
})));

0 commit comments

Comments
 (0)