org.apache.camel.health.HealthCheckRegistry Java Examples

The following examples show how to use org.apache.camel.health.HealthCheckRegistry. 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: HealthContextCustomizer.java    From camel-k-runtime with Apache License 2.0 7 votes vote down vote up
@Override
public void apply(CamelContext camelContext) {
    try {
        HealthCheckRegistry reg =  HealthCheckRegistry.get(camelContext);
        if (includeRoutes) {
            reg.addRepository(new RoutesHealthCheckRepository());
        }
        if (includeContext) {
            ContextHealthCheck contextHealthCheck = new ContextHealthCheck();
            contextHealthCheck.getConfiguration().setEnabled(true);

            reg.register(contextHealthCheck);
        }

        camelContext.addService(reg);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    // add health route
    addRoute(
        camelContext,
        VertxPlatformHttpRouter.lookup(camelContext)
    );
}
 
Example #2
Source File: MicroProfileHealthProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
CamelBeanBuildItem metricRegistry(CamelMicroProfileHealthRecorder recorder, CamelMicroProfileHealthConfig config) {
    return new CamelBeanBuildItem(
            "HealthCheckRegistry",
            HealthCheckRegistry.class.getName(),
            recorder.createHealthCheckRegistry(config));
}
 
Example #3
Source File: FastCamelContext.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Override
protected HealthCheckRegistry createHealthCheckRegistry() {
    return new BaseServiceResolver<>(HealthCheckRegistry.FACTORY, HealthCheckRegistry.class)
            .resolve(getCamelContextReference()).orElse(null);
}
 
Example #4
Source File: CamelMicroProfileHealthRecorder.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public RuntimeValue<HealthCheckRegistry> createHealthCheckRegistry(CamelMicroProfileHealthConfig config) {
    HealthCheckRegistry answer = new DefaultHealthCheckRegistry();
    answer.setId("camel-microprofile-health");
    answer.setEnabled(config.enabled);
    return new RuntimeValue<>(answer);
}