You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/06/09 09:21:43 UTC

[camel] branch master updated: camel-health - Log on startup if health check is enabled

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7f4b6e3  camel-health - Log on startup if health check is enabled
7f4b6e3 is described below

commit 7f4b6e3ee9775cb7b8e161e70527338097c0d264
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 9 11:21:05 2020 +0200

    camel-health - Log on startup if health check is enabled
---
 .../microprofile/health/CamelMicroProfileContextCheck.java     |  2 +-
 .../microprofile/health/CamelMicroProfileHealthCheckTest.java  |  4 ++--
 .../org/apache/camel/impl/engine/AbstractCamelContext.java     | 10 +++++-----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java
index aee7e38..4c1820b 100644
--- a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java
+++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java
@@ -42,7 +42,7 @@ public class CamelMicroProfileContextCheck implements HealthCheck, CamelContextA
     @Override
     public HealthCheckResponse call() {
         final HealthCheckResponseBuilder builder = HealthCheckResponse.builder();
-        builder.name("camel");
+        builder.name("camel-context-check");
         builder.down();
 
         if (camelContext != null) {
diff --git a/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
index 8781344..dac0691 100644
--- a/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
+++ b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
@@ -44,7 +44,7 @@ public class CamelMicroProfileHealthCheckTest extends CamelMicroProfileHealthTes
         JsonArray checks = healthObject.getJsonArray("checks");
         assertEquals(1, checks.size());
 
-        assertHealthCheckOutput("camel", State.UP, checks.getJsonObject(0), checksJson -> {
+        assertHealthCheckOutput("camel-context-check", State.UP, checks.getJsonObject(0), checksJson -> {
             assertEquals(ServiceStatus.Started.toString(), checksJson.getString("contextStatus"));
             assertEquals("health-context", checksJson.getString("name"));
         });
@@ -68,7 +68,7 @@ public class CamelMicroProfileHealthCheckTest extends CamelMicroProfileHealthTes
         JsonArray checks = healthObject.getJsonArray("checks");
         assertEquals(1, checks.size());
 
-        assertHealthCheckOutput("camel", State.DOWN, checks.getJsonObject(0), checksJson -> {
+        assertHealthCheckOutput("camel-context-check", State.DOWN, checks.getJsonObject(0), checksJson -> {
             assertEquals(ServiceStatus.Stopped.toString(), checksJson.getString("contextStatus"));
             assertEquals("health-context", checksJson.getString("name"));
         });
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index a2f1503..d1a0012 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -2794,6 +2794,11 @@ public abstract class AbstractCamelContext extends BaseService
             LOG.debug("Using ReactiveExecutor: {}", getReactiveExecutor());
         }
 
+        HealthCheckRegistry hcr = getExtension(HealthCheckRegistry.class);
+        if (hcr != null && hcr.isEnabled()) {
+            LOG.info("Using HealthCheck: {}", hcr.getId());
+        }
+
         // start routes
         if (doNotStartRoutesOnFirstStart) {
             LOG.debug("Skip starting routes as CamelContext has been configured with autoStartup=false");
@@ -2804,11 +2809,6 @@ public abstract class AbstractCamelContext extends BaseService
         internalRouteStartupManager.doStartOrResumeRoutes(routeServices, true, !doNotStartRoutesOnFirstStart, false, true);
         EventHelper.notifyCamelContextRoutesStarted(this);
 
-        HealthCheckRegistry hcr = getExtension(HealthCheckRegistry.class);
-        if (hcr != null && hcr.isEnabled()) {
-            LOG.debug("HealthCheck module loaded ({})", hcr.getId());
-        }
-
         long cacheCounter = beanIntrospection != null ? beanIntrospection.getCachedClassesCounter() : 0;
         if (cacheCounter > 0) {
             LOG.debug("Clearing BeanIntrospection cache with {} objects using during starting Camel", cacheCounter);