use of io.gravitee.gateway.services.healthcheck.vertx.VertxCompletableFuture in project gravitee-gateway by gravitee-io.
the class GatewayProbe method check.
@Override
public CompletableFuture<Result> check() {
VertxCompletableFuture<Result> result = new VertxCompletableFuture<>(vertx);
NetClientOptions options = new NetClientOptions().setConnectTimeout(500);
NetClient client = vertx.createNetClient(options);
client.connect(port, host, res -> {
if (res.succeeded()) {
result.complete(Result.healthy());
} else {
result.complete(Result.unhealthy(res.cause()));
}
client.close();
});
return result;
}
Aggregations