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 faa13b9  CAMEL-17629: camel-health - Removed option to disable context 
health check as it should always be enabled.
faa13b9 is described below

commit faa13b988a017914003d1375d937d8ebe42650cb
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 10 15:50:37 2022 +0100

    CAMEL-17629: camel-health - Removed option to disable context health check 
as it should always be enabled.
---
 .../camel/impl/health/ContextHealthCheck.java       |  7 +++++++
 .../HealthConfigurationPropertiesConfigurer.java    |  6 ------
 .../META-INF/camel-main-configuration-metadata.json |  1 -
 core/camel-main/src/main/docs/main.adoc             |  3 +--
 .../java/org/apache/camel/main/BaseMainSupport.java |  3 ---
 .../camel/main/HealthConfigurationProperties.java   | 21 ---------------------
 .../ROOT/pages/camel-3x-upgrade-guide-3_16.adoc     |  2 ++
 .../modules/ROOT/pages/health-check.adoc            |  3 +--
 8 files changed, 11 insertions(+), 35 deletions(-)

diff --git 
a/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
 
b/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
index 11e3729..069da3f 100644
--- 
a/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
+++ 
b/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
@@ -19,6 +19,7 @@ package org.apache.camel.impl.health;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Ordered;
 import org.apache.camel.health.HealthCheckResultBuilder;
 
 /**
@@ -33,6 +34,12 @@ public final class ContextHealthCheck extends 
AbstractHealthCheck {
     }
 
     @Override
+    public int getOrder() {
+        // context should always be first
+        return Ordered.HIGHEST;
+    }
+
+    @Override
     public boolean isLiveness() {
         // this check is only for readiness
         return false;
diff --git 
a/core/camel-main/src/generated/java/org/apache/camel/main/HealthConfigurationPropertiesConfigurer.java
 
b/core/camel-main/src/generated/java/org/apache/camel/main/HealthConfigurationPropertiesConfigurer.java
index a09904a..92fdf95 100644
--- 
a/core/camel-main/src/generated/java/org/apache/camel/main/HealthConfigurationPropertiesConfigurer.java
+++ 
b/core/camel-main/src/generated/java/org/apache/camel/main/HealthConfigurationPropertiesConfigurer.java
@@ -23,8 +23,6 @@ public class HealthConfigurationPropertiesConfigurer extends 
org.apache.camel.su
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "consumersenabled":
         case "ConsumersEnabled": 
target.setConsumersEnabled(property(camelContext, java.lang.Boolean.class, 
value)); return true;
-        case "contextenabled":
-        case "ContextEnabled": target.setContextEnabled(property(camelContext, 
java.lang.Boolean.class, value)); return true;
         case "enabled":
         case "Enabled": target.setEnabled(property(camelContext, 
java.lang.Boolean.class, value)); return true;
         case "excludepattern":
@@ -44,8 +42,6 @@ public class HealthConfigurationPropertiesConfigurer extends 
org.apache.camel.su
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "consumersenabled":
         case "ConsumersEnabled": return java.lang.Boolean.class;
-        case "contextenabled":
-        case "ContextEnabled": return java.lang.Boolean.class;
         case "enabled":
         case "Enabled": return java.lang.Boolean.class;
         case "excludepattern":
@@ -66,8 +62,6 @@ public class HealthConfigurationPropertiesConfigurer extends 
org.apache.camel.su
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "consumersenabled":
         case "ConsumersEnabled": return target.getConsumersEnabled();
-        case "contextenabled":
-        case "ContextEnabled": return target.getContextEnabled();
         case "enabled":
         case "Enabled": return target.getEnabled();
         case "excludepattern":
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 6a52b32..e5dc1a5 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -132,7 +132,6 @@
     { "name": "camel.faulttolerance.timeoutPoolSize", "description": 
"Configures the pool size of the thread pool when timeout is enabled. Default 
value is 10.", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type": 
"integer", "javaType": "java.lang.Integer", "defaultValue": 10 },
     { "name": "camel.faulttolerance.timeoutScheduledExecutorServiceRef", 
"description": "References to a custom thread pool to use when timeout is 
enabled", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.health.consumersEnabled", "description": "Whether 
consumers health check is enabled", "sourceType": 
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean", 
"javaType": "java.lang.Boolean", "defaultValue": true },
-    { "name": "camel.health.contextEnabled", "description": "Whether context 
health check is enabled", "sourceType": 
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean", 
"javaType": "java.lang.Boolean", "defaultValue": true },
     { "name": "camel.health.enabled", "description": "Whether health check is 
enabled globally", "sourceType": 
"org.apache.camel.main.HealthConfigurationProperties", "type": "boolean", 
"javaType": "java.lang.Boolean", "defaultValue": true },
     { "name": "camel.health.excludePattern", "description": "Pattern to 
exclude health checks from being invoked by Camel when checking healths. 
Multiple patterns can be separated by comma.", "sourceType": 
"org.apache.camel.main.HealthConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.health.exposureLevel", "description": "Sets the level of 
details to exposure as result of invoking health checks. There are the 
following levels: full, default, oneline The full level will include all 
details and status from all the invoked health checks. The default level will 
report UP if everything is okay, and only include detailed information for 
health checks that was DOWN. The oneline level will only report either UP or 
DOWN.", "sourceType": "org.apache.camel. [...]
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index e2f080a..4362f86 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -150,13 +150,12 @@ The camel.threadpool supports 8 options, which are listed 
below.
 |===
 
 === Camel Health Check configurations
-The camel.health supports 7 options, which are listed below.
+The camel.health supports 6 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *camel.health.consumersEnabled* | Whether consumers health check is enabled 
| true | Boolean
-| *camel.health.contextEnabled* | Whether context health check is enabled | 
true | Boolean
 | *camel.health.enabled* | Whether health check is enabled globally | true | 
Boolean
 | *camel.health.excludePattern* | Pattern to exclude health checks from being 
invoked by Camel when checking healths. Multiple patterns can be separated by 
comma. |  | String
 | *camel.health.exposureLevel* | Sets the level of details to exposure as 
result of invoking health checks. There are the following levels: full, 
default, oneline The full level will include all details and status from all 
the invoked health checks. The default level will report UP if everything is 
okay, and only include detailed information for health checks that was DOWN. 
The oneline level will only report either UP or DOWN. | default | String
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java 
b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index ff649be..e6e9a15 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -1009,9 +1009,6 @@ public abstract class BaseMainSupport extends BaseService 
{
         if (hcr.isEnabled()) {
             HealthCheck hc = (HealthCheck) hcr.resolveById("context");
             if (hc != null) {
-                if (health.getContextEnabled() != null) {
-                    hc.setEnabled(health.getContextEnabled());
-                }
                 hcr.register(hc);
             }
         }
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/HealthConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/HealthConfigurationProperties.java
index 04ea3af..1b1e991 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/HealthConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/HealthConfigurationProperties.java
@@ -31,8 +31,6 @@ public class HealthConfigurationProperties implements 
BootstrapCloseable {
     @Metadata(defaultValue = "true")
     private Boolean enabled;
     @Metadata(defaultValue = "true")
-    private Boolean contextEnabled;
-    @Metadata(defaultValue = "true")
     private Boolean routesEnabled;
     @Metadata(defaultValue = "true")
     private Boolean consumersEnabled;
@@ -67,17 +65,6 @@ public class HealthConfigurationProperties implements 
BootstrapCloseable {
         this.enabled = enabled;
     }
 
-    public Boolean getContextEnabled() {
-        return contextEnabled;
-    }
-
-    /**
-     * Whether context health check is enabled
-     */
-    public void setContextEnabled(Boolean contextEnabled) {
-        this.contextEnabled = contextEnabled;
-    }
-
     public Boolean getRoutesEnabled() {
         return routesEnabled;
     }
@@ -151,14 +138,6 @@ public class HealthConfigurationProperties implements 
BootstrapCloseable {
     }
 
     /**
-     * Whether context health check is enabled
-     */
-    public HealthConfigurationProperties withContextEnabled(boolean 
contextEnabled) {
-        this.contextEnabled = contextEnabled;
-        return this;
-    }
-
-    /**
      * Whether routes health check is enabled
      */
     public HealthConfigurationProperties withRoutesEnabled(boolean 
routesEnabled) {
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc
index b7c8e49..fd5e26d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc
@@ -63,6 +63,8 @@ These options would complicate health checks as they affect 
the outcome of healt
 It is better the checks always execute and the responsibility of the 
monitoring systems
 how to deal with interval between checks and thresholds.
 
+Removed the option to disable context health check as it should always be 
enabled.
+
 ==== Disabling health checks
 
 The configuration for disabling individual health-checks has changed
diff --git a/docs/user-manual/modules/ROOT/pages/health-check.adoc 
b/docs/user-manual/modules/ROOT/pages/health-check.adoc
index a8b07f0..3cce486 100644
--- a/docs/user-manual/modules/ROOT/pages/health-check.adoc
+++ b/docs/user-manual/modules/ROOT/pages/health-check.adoc
@@ -57,7 +57,7 @@ Camel supports via `camel-main` to configure health-checks 
from configuration fi
 such as Camel on Spring Boot, or Camel K.
 
 Camel will automatically enable `context`, `routes`, `consumers`, and 
`registry` health-checks if `camel-health` is detected on the classpath.
-They are all enabled by default. However, you can configure them, for example 
to turn them off:
+They are all enabled by default (context is always enabled and cannot be 
disabled). However, you can configure them, for example to turn them off:
 
 [source,properties]
 ----
@@ -66,7 +66,6 @@ They are all enabled by default. However, you can configure 
them, for example to
 
 # allows to enable or disable health-checks from startup
 # for example to only use context health-check
-camel.health.contextEnabled=true
 camel.health.routesEnabled=false
 camel.health.consumersEnabled=false
 camel.health.registryEnabled=false

Reply via email to