use of io.vertx.starter.service.GeneratorService in project vertx-starter by vert-x3.
the class GeneratorVerticle method start.
@Override
public void start(Promise<Void> startPromise) {
vertx.fileSystem().readFile("keywords", kar -> {
if (kar.succeeded()) {
Set<String> keywords = NEWLINE_REGEX.splitAsStream(kar.result().toString()).map(String::trim).filter(s -> !s.isEmpty()).collect(toSet());
generatorService = new GeneratorService(vertx, keywords);
MessageConsumer<VertxProject> consumer = vertx.eventBus().consumer(Topics.PROJECT_REQUESTED);
consumer.handler(this::onProjectRequested).completionHandler(ar -> {
if (ar.succeeded()) {
log.info("\n----------------------------------------------------------\n\t" + "{} is running!\n" + "----------------------------------------------------------", GeneratorVerticle.class.getSimpleName());
startPromise.complete();
} else {
startPromise.fail(ar.cause());
}
});
} else {
startPromise.fail(kar.cause());
}
});
}
Aggregations