Skip to content

Commit

Permalink
Fix HttpGreetingVerticle example
Browse files Browse the repository at this point in the history
Use the same code as in the main branch (except the verticle in the main branch extends VerticleBase).

Signed-off-by: Thomas Segismont <[email protected]>
  • Loading branch information
tsegismont committed Jan 7, 2025
1 parent 945e184 commit 8046871
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions vertx-config/src/main/java/examples/HttpGreetingVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import io.vertx.config.ConfigRetriever;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.json.JsonObject;
import io.vertx.core.Promise;

public class HttpGreetingVerticle extends AbstractVerticle {

@Override
public void start() {
public void start(Promise<Void> startPromise) {
ConfigRetriever retriever = ConfigRetriever.create(vertx);
retriever.getConfig().onComplete(result -> {
JsonObject json = result.result();

vertx.createHttpServer()
retriever
.getConfig()
.compose(json -> vertx.createHttpServer()
.requestHandler(req -> req.response().end(json.getString("message")))
.listen(json.getInteger("port"));
});
.listen(json.getInteger("port"))
)
.<Void>mapEmpty()
.onComplete(startPromise);
}
}

0 comments on commit 8046871

Please sign in to comment.