You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2022/10/24 10:38:20 UTC

[camel-spring-boot] branch main updated: CAMEL-18617: Some health checks are hidden when running withg supervised controller enabled

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

lburgazzoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 952dcbab608 CAMEL-18617: Some health checks are hidden when running withg supervised controller enabled
952dcbab608 is described below

commit 952dcbab608ff537c7945e31312864d4380a73fa
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Thu Oct 20 14:51:59 2022 +0200

    CAMEL-18617: Some health checks are hidden when running withg supervised controller enabled
---
 core/camel-spring-boot/src/main/docs/spring-boot.json     |  6 ++++++
 .../actuate/health/CamelHealthCheckAutoConfiguration.java | 11 +++++++++++
 .../health/CamelHealthCheckConfigurationProperties.java   | 15 +++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json b/core/camel-spring-boot/src/main/docs/spring-boot.json
index f4f3d3b1ecd..cf9e5d5a340 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -421,6 +421,12 @@
       "sourceType": "org.apache.camel.spring.boot.DataFormatConfigurationProperties",
       "defaultValue": true
     },
+    {
+      "name": "camel.health.components-enabled",
+      "type": "java.lang.Boolean",
+      "description": "Whether components health check is enabled. <p> Is default enabled",
+      "sourceType": "org.apache.camel.spring.boot.actuate.health.CamelHealthCheckConfigurationProperties"
+    },
     {
       "name": "camel.health.consumers-enabled",
       "type": "java.lang.Boolean",
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
index 02f2f7085a4..5b982870d20 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
@@ -101,6 +101,17 @@ public class CamelHealthCheckAutoConfiguration {
                     hcr.register(hc);
                 }
             }
+            // components are enabled by default
+            if (hcr.isEnabled()) {
+                HealthCheckRepository hc
+                    = hcr.getRepository("components").orElse((HealthCheckRepository) hcr.resolveById("components"));
+                if (hc != null) {
+                    if (config.getComponentsEnabled() != null) {
+                        hc.setEnabled(config.getComponentsEnabled());
+                    }
+                    hcr.register(hc);
+                }
+            }
             // consumers are enabled by default
             if (hcr.isEnabled()) {
                 HealthCheckRepository hc
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationProperties.java
index 5e8d1eb0ee6..e9ceaa98767 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationProperties.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationProperties.java
@@ -36,6 +36,13 @@ public class CamelHealthCheckConfigurationProperties {
      */
     private Boolean routesEnabled;
 
+    /**
+     * Whether components health check is enabled.
+     * <p>
+     * Is default enabled
+     */
+    private Boolean componentsEnabled;
+
     /**
      * Whether consumers health check is enabled.
      * <p>
@@ -120,6 +127,14 @@ public class CamelHealthCheckConfigurationProperties {
         this.registryEnabled = registryEnabled;
     }
 
+    public Boolean getComponentsEnabled() {
+        return componentsEnabled;
+    }
+
+    public void setComponentsEnabled(Boolean componentsEnabled) {
+        this.componentsEnabled = componentsEnabled;
+    }
+
     public String getExcludePattern() {
         return excludePattern;
     }