This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new dba1cb013fc Update health-check.adoc (#16480)
dba1cb013fc is described below

commit dba1cb013fc3c1e618902a8ca6848605fbbf2470
Author: Raymond Meester <raymondmees...@gmail.com>
AuthorDate: Sun Dec 8 09:18:31 2024 +0100

    Update health-check.adoc (#16480)
    
    - Clarify liveness/readiness
    - Add java examples for liveness/readiness and configuring health checks
---
 .../modules/ROOT/pages/health-check.adoc           | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/docs/user-manual/modules/ROOT/pages/health-check.adoc 
b/docs/user-manual/modules/ROOT/pages/health-check.adoc
index ea4af0b088f..bf466ed7fcf 100644
--- a/docs/user-manual/modules/ROOT/pages/health-check.adoc
+++ b/docs/user-manual/modules/ROOT/pages/health-check.adoc
@@ -41,7 +41,18 @@ is named foo, then the ID is `consumer:foo`.
 
 == Readiness and Liveness
 
-A health check is by default usable for both readiness and liveness checks.
+Readiness and Liveness probes serve distinct purposes. Readiness indicates 
whether the application is ready to serve requests or traffic. 
+Liveness probes indicates whether the application is alive and functioning. A 
health check is by default usable for both readiness and liveness checks.
+
+To check wether a health check is usable for readiness or livesness:
+
+[source,java]
+----
+HealthCheck healthCheck = HealthCheckHelper.getHealthCheck(camelContext, 
healthCheckId);
+
+System.out.println("Readiness=" + healthCheck.isReadiness());
+System.out.println("Live=" + healthCheck.isLiveness());
+----
 
 To specify a custom health check as only usable for liveness checks,
 you would need to turn off readiness, by overriding the `isReadiness` method 
and return `false`.
@@ -76,6 +87,19 @@ camel.health.consumersEnabled=false
 camel.health.registryEnabled=false
 ----
 
+The same can also be done programmatically using the Camel health api:
+
+[source,java]
+----
+HealthCheckRepository consumersHealthCheckRepository = 
HealthCheckHelper.getHealthCheckRepository(context, "consumers");
+
+if(consumersHealthCheckRepository!=null) {
+       consumersHealthCheckRepository.setEnabled(false);
+}
+----
+
+
+
 === Configuring initial state
 
 The initial state of health-checks (readiness). There are the following 
states: UP, DOWN, UNKNOWN.

Reply via email to