Java Code Examples for org.eclipse.microprofile.health.HealthCheckResponse#down()

The following examples show how to use org.eclipse.microprofile.health.HealthCheckResponse#down() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseLivenessCheck.java    From blog-tutorials with MIT License 6 votes vote down vote up
@Override
public HealthCheckResponse call() {

    try (var connection = dataSource.getConnection()) {
        var metaData = connection.getMetaData();

        return HealthCheckResponse.builder()
                .name(livenessCheckName)
                .withData("version", String.format("%s - %s.%s",
                        metaData.getDatabaseProductName(),
                        metaData.getDatabaseMajorVersion(),
                        metaData.getDatabaseMinorVersion()))
                .withData("schema", connection.getSchema())
                .withData("databaseName", connection.getCatalog())
                .up()
                .build();
    } catch (SQLException e) {
        return HealthCheckResponse.down(livenessCheckName);
    }
}
 
Example 2
Source File: ShutdownReadinessCheck.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public HealthCheckResponse call() {
    if (shuttingDown) {
        return HealthCheckResponse.down(GRACEFUL_SHUTDOWN);
    }
    return HealthCheckResponse.up(GRACEFUL_SHUTDOWN);
}
 
Example 3
Source File: ReadinessHealthCheck.java    From javaee8-cookbook with Apache License 2.0 5 votes vote down vote up
@Override
public HealthCheckResponse call() {
    if (isAcessible()){
        return HealthCheckResponse.up("I'm up and ready!");
    } else{
        return HealthCheckResponse.down("I'm up, but not ready...");
    }
}
 
Example 4
Source File: ChangingLivenessHealthCheck.java    From smallrye-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return invocations.getAndIncrement() == 0 ? HealthCheckResponse.up("up") : HealthCheckResponse.down("down");
}
 
Example 5
Source File: FailedWellness.java    From smallrye-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down("failed-check");
}
 
Example 6
Source File: FailedCustom.java    From smallrye-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down("failed-check");
}
 
Example 7
Source File: FailedLiveness.java    From microprofile-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down("failed-check");
}
 
Example 8
Source File: CDIProducedProcedureCheck.java    From microprofile-health with Apache License 2.0 4 votes vote down vote up
@Produces
@Readiness
HealthCheck cdiProducedReadinessCheck() {
    return () -> HealthCheckResponse.down("cdi-produced-failed-check");
}
 
Example 9
Source File: FailedReadiness.java    From microprofile-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down("failed-check");
}
 
Example 10
Source File: DelayedCheck.java    From microprofile-health with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down("delayed-check");
}
 
Example 11
Source File: TestDownReadinessHC.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return HealthCheckResponse.down(TestDownReadinessHC.class.getSimpleName());
}