Search in sources :

Example 1 with HealthCheckResponseBuilder

use of org.eclipse.microprofile.health.HealthCheckResponseBuilder in project wildfly by wildfly.

the class MicroProfileHealthReporterService method wrap.

static HealthCheck wrap(ServerProbe delegate) {
    return new HealthCheck() {

        @Override
        public HealthCheckResponse call() {
            ServerProbe.Outcome outcome = delegate.getOutcome();
            HealthCheckResponseBuilder check = HealthCheckResponse.named(delegate.getName()).status(outcome.isSuccess());
            if (outcome.getData().isDefined()) {
                for (Property property : outcome.getData().asPropertyList()) {
                    check.withData(property.getName(), property.getValue().asString());
                }
            }
            return check.build();
        }
    };
}
Also used : ServerProbe(org.wildfly.extension.health.ServerProbe) HealthCheckResponseBuilder(org.eclipse.microprofile.health.HealthCheckResponseBuilder) HealthCheck(org.eclipse.microprofile.health.HealthCheck) Property(org.jboss.dmr.Property)

Aggregations

HealthCheck (org.eclipse.microprofile.health.HealthCheck)1 HealthCheckResponseBuilder (org.eclipse.microprofile.health.HealthCheckResponseBuilder)1 Property (org.jboss.dmr.Property)1 ServerProbe (org.wildfly.extension.health.ServerProbe)1