org.eclipse.microprofile.health.Readiness Java Examples
The following examples show how to use
org.eclipse.microprofile.health.Readiness.
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: ExpectedBeansUnitTest.java From quarkus with Apache License 2.0 | 6 votes |
/** * Test metadata on HealthCheck procedure beans */ @Test public void testHealthCheckMetadata() { Instance<HealthCheck> selects; selects = checks.select(Liveness.Literal.INSTANCE); Assertions.assertTrue(isUnique(selects)); selects = checks.select(Readiness.Literal.INSTANCE); Assertions.assertTrue(isUnique(selects)); selects = checks.select(HealthGroup.Literal.of("group1")); Assertions.assertTrue(isUnique(selects)); selects = checks.select(HealthGroup.Literal.of("group2")); Assertions.assertTrue(isUnique(selects)); selects = checks.select(Liveness.Literal.INSTANCE, Readiness.Literal.INSTANCE, HealthGroup.Literal.of("group1"), HealthGroup.Literal.of("group2")); Assertions.assertTrue(isUnique(selects)); Assertions.assertTrue(checks.select(HealthGroup.Literal.of("group3")).isUnsatisfied()); }
Example #2
Source File: ShutdownReadinessListener.java From quarkus with Apache License 2.0 | 5 votes |
@Override public void preShutdown(ShutdownNotification notification) { Instance<ShutdownReadinessCheck> instance = CDI.current().select(ShutdownReadinessCheck.class, Readiness.Literal.INSTANCE); if (!instance.isUnsatisfied()) { instance.get().shutdown(); } notification.done(); }
Example #3
Source File: HealthCheckProducerDefaultScopeTest.java From quarkus with Apache License 2.0 | 4 votes |
@Readiness HealthCheck alpha() { int idx = ALPHA_COUNTER.incrementAndGet(); return () -> HealthCheckResponse.builder().up().name("alpha" + idx).build(); }
Example #4
Source File: HealthCheckProducerDefaultScopeTest.java From quarkus with Apache License 2.0 | 4 votes |
@Dependent @Readiness HealthCheck bravo() { int idx = BRAVO_COUNTER.incrementAndGet(); return () -> HealthCheckResponse.builder().up().name("bravo" + idx).build(); }
Example #5
Source File: CDIProducedProcedureCheck.java From microprofile-health with Apache License 2.0 | 4 votes |
@Produces @Readiness HealthCheck cdiProducedReadinessCheck() { return () -> HealthCheckResponse.down("cdi-produced-failed-check"); }
Example #6
Source File: KeycloakHealthChecks.java From keycloak-extension-playground with Apache License 2.0 | 3 votes |
@Produces @Readiness HealthCheck databaseCheck() { HealthCheckResponseBuilder databaseHealth = HealthCheckResponse.named("keycloak:database"); boolean databaseReady = isDatabaseReady(); return () -> (databaseReady ? databaseHealth.up() : databaseHealth.down()).build(); }