Skip to content

Commit

Permalink
Upgrade to Vert.x 5
Browse files Browse the repository at this point in the history
  • Loading branch information
tsegismont committed Dec 2, 2024
1 parent 93a5749 commit 73f5d56
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,5 @@ This document covered:

== See also

- https://www.graphql-java.com/documentation/v12/[The GraphQL-Java documentation]
- https://www.graphql-java.com/documentation/getting-started[The GraphQL-Java documentation]
- https://vertx.io/docs/vertx-web-graphql/java/[The Vert.x Web GraphQL Handler documentation]
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ java {
}

dependencies {
implementation(platform("io.vertx:vertx-stack-depchain:4.4.0"))
implementation(platform("io.vertx:vertx-stack-depchain:5.0.0.CR2"))
implementation("io.vertx:vertx-web-graphql")
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>1.0-SNAPSHOT</version>

<properties>
<vertx.version>4.4.0</vertx.version>
<vertx.version>5.0.0.CR2</vertx.version>
</properties>

<dependencyManagement>
Expand Down
18 changes: 7 additions & 11 deletions src/main/java/io/vertx/howtos/graphql/GraphQLVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.idl.SchemaGenerator;
import graphql.schema.idl.SchemaParser;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.VerticleBase;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.BodyHandler;
Expand All @@ -19,13 +20,13 @@
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;

public class GraphQLVerticle extends AbstractVerticle {
public class GraphQLVerticle extends VerticleBase {

// tag::start[]
private Map<String, Task> tasks;

@Override
public void start() {
public Future<?> start() {
tasks = initData();

var graphQL = setupGraphQL();
Expand All @@ -35,7 +36,7 @@ public void start() {
router.route().handler(BodyHandler.create()); // <2>
router.route("/graphql").handler(graphQLHandler); // <3>

vertx.createHttpServer()
return vertx.createHttpServer()
.requestHandler(router)
.listen(8080);
}
Expand Down Expand Up @@ -94,13 +95,8 @@ private boolean complete(DataFetchingEnvironment env) {
// tag::main[]
public static void main(String[] args) {
var vertx = Vertx.vertx(); // <1>
vertx.deployVerticle(new GraphQLVerticle()).onComplete(ar -> { // <2>
if (ar.succeeded()) {
System.out.println("Verticle deployed");
} else {
ar.cause().printStackTrace();
}
});
vertx.deployVerticle(new GraphQLVerticle()).await(); // <2>
System.out.println("Verticle deployed");
}
// end::main[]
}

0 comments on commit 73f5d56

Please sign in to comment.