org.apache.camel.health.HealthCheck Java Examples
The following examples show how to use
org.apache.camel.health.HealthCheck.
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: CamelHealthCheckIndicator.java From camel-spring-boot with Apache License 2.0 | 6 votes |
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { builder.withDetail("name", "camel-health-check"); builder.up(); if (camelContext != null) { Collection<HealthCheck.Result> results = HealthCheckHelper.invoke(camelContext); for (HealthCheck.Result result : results) { Map<String, Object> details = result.getDetails(); boolean enabled = true; if (details.containsKey(AbstractHealthCheck.CHECK_ENABLED)) { enabled = (boolean) details.get(AbstractHealthCheck.CHECK_ENABLED); } if (enabled) { builder.withDetail(result.getCheck().getId(), result.getState().name()); if (result.getState() == HealthCheck.State.DOWN) { builder.down(); } } } } }