use of org.wildfly.extension.health.ServerProbe in project wildfly by wildfly.
the class MicroProfileHealthReporterService method start.
@Override
public void start(StartContext context) {
// MicroProfile Health supports the mp.health.disable-default-procedures to let users disable any vendor procedures
final boolean defaultServerProceduresDisabled = ConfigProvider.getConfig().getOptionalValue("mp.health.disable-default-procedures", Boolean.class).orElse(false);
// MicroProfile Health supports the mp.health.default.readiness.empty.response to let users specify default empty readiness responses
final String defaultReadinessEmptyResponse = ConfigProvider.getConfig().getOptionalValue("mp.health.default.readiness.empty.response", String.class).orElse("DOWN");
// MicroProfile Health supports the mp.health.default.startup.empty.response to let users specify default empty startup responses
final String defaultStartupEmptyResponse = ConfigProvider.getConfig().getOptionalValue("mp.health.default.startup.empty.response", String.class).orElse("DOWN");
healthReporter = new MicroProfileHealthReporter(emptyLivenessChecksStatus, emptyReadinessChecksStatus, emptyStartupChecksStatus, defaultServerProceduresDisabled, defaultReadinessEmptyResponse, defaultStartupEmptyResponse);
if (!defaultServerProceduresDisabled) {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
for (ServerProbe serverProbe : serverProbesService.get().getServerProbes()) {
healthReporter.addServerReadinessCheck(wrap(serverProbe), tccl);
}
}
HealthCheckResponse.setResponseProvider(new ResponseProvider());
}
use of org.wildfly.extension.health.ServerProbe 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();
}
};
}
Aggregations