vertx-examples
vertx-examples copied to clipboard
Vert.x 5 update
Considerations:
- convert
AbstractVerticletoVerticleBase - use test containers whenever possible : Mongo / Cassandra / ...
- refresh
- Web Client Twitter Oauth example
- ...
- cleanups
- Gradle
See
- https://github.com/eclipse-vertx/vertx-launcher/issues/12
Server verticle
- rely on the launcher to print the verticle deployment failure
// 4.x
public static void main(String[] args) {
VertxApplication.main(new String[]{Server.class.getName()});
}
...
public void start() {
...
server.listen().onComplete(ar -> {
if (ar.succeeded()) {
System.out.println("Server started");
} else {
System.out.println("Server listen failed " + ar.cause().getMessage());
}
});
}
// 5.0
public static void main(String[] args) {
VertxApplication.main(new String[]{Server.class.getName()});
System.out.println("Server started");
}
...
public Future<?> start() {
...
return server.listen();
}
Client verticle
- rely on the launcher to print the verticle deployment failure
// 4.x
public void start() {
...
return client.asyncInteraction()
.onSuccess(response -> System.out.println("Got response"))
.onFailure(error -> System.out.println("Failed" + error.getMessage()));
}
// 5.0
public Future<?> start() {
...
return client.asyncInteraction()
.onSuccess(response -> System.out.println("Got response"));
}
cc @tsegismont
client tests should get away from using a verticle, a plain main should be enough
I believe we should review all client classes and make a decision on a case-by-case basis.
@tsegismont I think we will keep with VerticleBase for clients
- Per db client
What do you mean with this?
- Per db client
What do you mean with this?
I wish we could have at least one example for each database client using test container.