Here is my database healthcheck :
@Readiness
@ApplicationScoped
@Slf4j
public class DatabaseConnectionHealthCheck implements HealthCheck {
@Inject
PgPool pgPool;
@Override
public HealthCheckResponse call() {
final HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named("Database connection health check");
try {
pgPool.getConnection().await().indefinitely();
log.info("Database Connection Health Check - Success");
responseBuilder.up();
} catch( CompletionException e ){
log.info("Database Connection Health Check - Failure - Cause {}", e.getMessage());
responseBuilder
.down()
.withData(
"Cause",
e.getMessage()
);
}
return responseBuilder.build();
}
}
The problem is that is do .await().indefinitely() and I don't want it (io.vertx.core.VertxException: Thread blocked)
How to responseBuiler.up() in a reactive / subscribe way ?
Thanks