Search in sources :

Example 1 with HealthCheckRegistry

use of org.apache.camel.health.HealthCheckRegistry in project camel-quarkus by apache.

the class MicroProfileHealthResource method healthCheckEnabled.

@Path("/{healthCheckId}")
@POST
public void healthCheckEnabled(@PathParam("healthCheckId") String healthCheckId, @QueryParam("healthCheckEnabled") boolean isHealthCheckEnabled) {
    HealthCheckRegistry registry = camelContext.getExtension(HealthCheckRegistry.class);
    registry.getCheck(healthCheckId).ifPresent(healthCheck -> {
        healthCheck.getConfiguration().setEnabled(isHealthCheckEnabled);
        if (isHealthCheckEnabled) {
            registry.register(healthCheck);
        } else {
            registry.unregister(healthCheck);
        }
    });
}
Also used : HealthCheckRegistry(org.apache.camel.health.HealthCheckRegistry) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 2 with HealthCheckRegistry

use of org.apache.camel.health.HealthCheckRegistry in project camel-quarkus by apache.

the class MicroProfileHealthEnabledTest method healthCheckRegistryNotNull.

@Test
public void healthCheckRegistryNotNull() {
    HealthCheckRegistry registry = HealthCheckRegistry.get(context);
    assertNotNull(registry);
    assertTrue(registry instanceof CamelMicroProfileHealthCheckRegistry);
    assertEquals("camel-microprofile-health", registry.getId());
}
Also used : CamelMicroProfileHealthCheckRegistry(org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckRegistry) HealthCheckRegistry(org.apache.camel.health.HealthCheckRegistry) CamelMicroProfileHealthCheckRegistry(org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckRegistry) QuarkusUnitTest(io.quarkus.test.QuarkusUnitTest) Test(org.junit.jupiter.api.Test)

Aggregations

HealthCheckRegistry (org.apache.camel.health.HealthCheckRegistry)2 QuarkusUnitTest (io.quarkus.test.QuarkusUnitTest)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 CamelMicroProfileHealthCheckRegistry (org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckRegistry)1 Test (org.junit.jupiter.api.Test)1