public void start(Future<Void> startFuture) {
// ConfigStore from Kube/OCPs
Future<JsonObject> f1 = Future.future();
this.initConfigRetriever(f1.completer())
.compose(this::asyncLoadDbSchema)
.compose(this::provisionRouter)
.compose(this::createHttpServer, startFuture);
}
Future<OpenAPI3RouterFactory> provisionRouter(Void v) {
System.out.println("Router provisioning");
service = AdjectiveService.createProxy(vertx, "adjective.service");
Future<OpenAPI3RouterFactory> future = Future.future();
createRouterFactoryFromFile(vertx, "adjective.yml", future.completer());
return future;
}
public void start(Future<Void> startFuture) {
// ConfigStore from Kube/OCPs
Future<JsonObject> f1 = Future.future();
this.initConfigRetriever(f1.completer())
.compose(this::asyncLoadDbSchema)
.compose(this::provisionRouter)
.compose(f -> createHttpServer(startFuture, f), startFuture);
}
void createHttpServer(Future startFuture, OpenAPI3RouterFactory factory) {
System.out.println("Adding API handles");
factory.addHandlerByOperationId("getAdjective", this::handleAdjGet);
factory.addHandlerByOperationId("saveAdjective", this::handleAdjPost);
factory.addHandlerByOperationId("health", this::healthCheck);
System.out.println("Creating HTTP Server");
JsonObject httpJsonCfg = vertx
.getOrCreateContext()
.config()
.getJsonObject("http");
HttpServerOptions httpConfig = new HttpServerOptions(httpJsonCfg);
vertx.createHttpServer(httpConfig)
.requestHandler(factory.getRouter()::accept)
.listen(startFuture.completer());
}
public void start(Future<Void> startFuture) {
vertx.eventBus().consumer("msg.ping").handler(msg -> {
msg.reply(String.format("Pong: %d", Instant.now().getEpochSecond()));
});
Future<Message<String>> f1 = Future.future();
vertx.eventBus().send("msg.ping", null, f1.completer());
f1.compose(this::pingHandler)
.compose(this::pingHandler)
.compose(this::pingHandler)
.compose(this::pingHandler)
.compose(this::pingHandler)
.compose(this::pingHandler)
.compose(m -> {
pingHandler(m).setHandler(res -> {
if (res.succeeded()) {
startFuture.complete();
} else {
startFuture.fail(res.cause());
}
});
}, startFuture);
}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/675fb1ec-09a1-46e2-b264-470f81a7e6ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/f6b1099c-e145-4f1e-b718-92960bcde80d%40googlegroups.com.