You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/03/23 16:41:16 UTC
[camel-quarkus] branch master updated: Use AbstractHealthCheck for
custom health checks
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new ab75b93 Use AbstractHealthCheck for custom health checks
ab75b93 is described below
commit ab75b932c8cfe35db00ebaeb23510d0e21165ec4
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Mar 23 14:02:24 2021 +0000
Use AbstractHealthCheck for custom health checks
---
.../ROOT/pages/reference/extensions/microprofile-health.adoc | 3 +--
extensions/microprofile-health/runtime/src/main/doc/usage.adoc | 3 +--
.../quarkus/component/microprofile/it/health/LivenessCheck.java | 9 +++++++--
.../quarkus/component/microprofile/it/health/ReadinessCheck.java | 9 +++++++--
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc b/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc
index 170fd7c..e2df638 100644
--- a/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc
@@ -37,8 +37,7 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
You can register health checks for your applications with the xref:latest@manual::health-check.adoc[Camel health check API].
-By default, classes extending `AbstractHealthCheck` are registered as both liveness and readiness checks. For finer control over whether
-a check is registered as a liveness or readiness check, you can extend either `AbstractCamelMicroProfileLivenessCheck` or `AbstractCamelMicroProfileReadinessCheck`.
+By default, classes extending `AbstractHealthCheck` are registered as both liveness and readiness checks. You can override the `isReadiness` method to control this behaviour.
Any checks provided by your application are automatically discovered and bound to the Camel registry. They will be available via
the Quarkus health endpoints `/health/live` and `/health/ready`.
diff --git a/extensions/microprofile-health/runtime/src/main/doc/usage.adoc b/extensions/microprofile-health/runtime/src/main/doc/usage.adoc
index e4327e8..06d0fc8 100644
--- a/extensions/microprofile-health/runtime/src/main/doc/usage.adoc
+++ b/extensions/microprofile-health/runtime/src/main/doc/usage.adoc
@@ -1,7 +1,6 @@
You can register health checks for your applications with the xref:latest@manual::health-check.adoc[Camel health check API].
-By default, classes extending `AbstractHealthCheck` are registered as both liveness and readiness checks. For finer control over whether
-a check is registered as a liveness or readiness check, you can extend either `AbstractCamelMicroProfileLivenessCheck` or `AbstractCamelMicroProfileReadinessCheck`.
+By default, classes extending `AbstractHealthCheck` are registered as both liveness and readiness checks. You can override the `isReadiness` method to control this behaviour.
Any checks provided by your application are automatically discovered and bound to the Camel registry. They will be available via
the Quarkus health endpoints `/health/live` and `/health/ready`.
diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/LivenessCheck.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/LivenessCheck.java
index fbe544e..8e5a135 100644
--- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/LivenessCheck.java
+++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/LivenessCheck.java
@@ -19,9 +19,9 @@ package org.apache.camel.quarkus.component.microprofile.it.health;
import java.util.Map;
import org.apache.camel.health.HealthCheckResultBuilder;
-import org.apache.camel.microprofile.health.AbstractCamelMicroProfileLivenessCheck;
+import org.apache.camel.impl.health.AbstractHealthCheck;
-public class LivenessCheck extends AbstractCamelMicroProfileLivenessCheck {
+public class LivenessCheck extends AbstractHealthCheck {
public LivenessCheck() {
super("test-liveness");
@@ -31,4 +31,9 @@ public class LivenessCheck extends AbstractCamelMicroProfileLivenessCheck {
protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) {
builder.up();
}
+
+ @Override
+ public boolean isReadiness() {
+ return false;
+ }
}
diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/ReadinessCheck.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/ReadinessCheck.java
index abbfab0..4aaf863 100644
--- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/ReadinessCheck.java
+++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/ReadinessCheck.java
@@ -19,9 +19,9 @@ package org.apache.camel.quarkus.component.microprofile.it.health;
import java.util.Map;
import org.apache.camel.health.HealthCheckResultBuilder;
-import org.apache.camel.microprofile.health.AbstractCamelMicroProfileReadinessCheck;
+import org.apache.camel.impl.health.AbstractHealthCheck;
-public class ReadinessCheck extends AbstractCamelMicroProfileReadinessCheck {
+public class ReadinessCheck extends AbstractHealthCheck {
public ReadinessCheck() {
super("test-readiness");
@@ -31,4 +31,9 @@ public class ReadinessCheck extends AbstractCamelMicroProfileReadinessCheck {
protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) {
builder.up();
}
+
+ @Override
+ public boolean isLiveness() {
+ return false;
+ }
}