Skip to content

Commit 06b5e49

Browse files
authored
chore: Update Vert.x version to 5.0.4 (#377)
Closes: #376 Signed-off-by: Athira Sreekumar [email protected]
1 parent ec03822 commit 06b5e49

File tree

6 files changed

+27
-28
lines changed

6 files changed

+27
-28
lines changed

.github/workflows/github-build-release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
15-
- name: Set up JDK 1.8
16-
uses: actions/setup-java@v1
14+
uses: actions/checkout@v4
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v4
1717
with:
18-
java-version: 1.8
18+
java-version: '11'
19+
distribution: 'temurin'
1920
- name: Build
2021
run: mvn package
2122
- name: Create Release

.github/workflows/java-pr-jobs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ jobs:
1212
name: Build and Test
1313

1414
steps:
15-
- uses: actions/checkout@v2
16-
- name: Set up JDK 1.8
17-
uses: actions/setup-java@v1
15+
- uses: actions/checkout@v4
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v4
1818
with:
19-
java-version: 1.8
19+
java-version: '11'
20+
distribution: 'temurin'
2021
- name: Build and test
2122
run: mvn verify

pom.xml

Lines changed: 4 additions & 4 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>

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)