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 2021/11/04 10:06:07 UTC

[camel] branch main updated (e2926ad -> 19db1c4)

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

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


    from e2926ad  Javadoc
     new e6a215f  CAMEL-15133: camel-health - Make all consumers capable of providing custom health checks
     new 19db1c4  Upgrade to vertx 4.1.6

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 camel-dependencies/pom.xml                               |  2 +-
 core/camel-api/src/main/java/org/apache/camel/Route.java | 16 ++++++++--------
 .../src/main/java/org/apache/camel/spi/RouteError.java   |  8 ++++----
 .../org/apache/camel/impl/health/RouteHealthCheck.java   |  8 +++++---
 .../java/org/apache/camel/support/DefaultConsumer.java   | 15 ++++++++++++++-
 .../org/apache/camel/support/ScheduledPollConsumer.java  | 16 ++--------------
 parent/pom.xml                                           |  2 +-
 7 files changed, 35 insertions(+), 32 deletions(-)

[camel] 02/02: Upgrade to vertx 4.1.6

Posted by da...@apache.org.
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

commit 19db1c4a201365c8db6b84e52500bb35fa7ca2f5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 4 11:05:31 2021 +0100

    Upgrade to vertx 4.1.6
---
 camel-dependencies/pom.xml | 2 +-
 parent/pom.xml             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index 36686d1..bcd647f 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -551,7 +551,7 @@
     <vavr-version>0.10.2</vavr-version>
     <velocity-tools-version>3.1</velocity-tools-version>
     <velocity-version>2.3</velocity-version>
-    <vertx-version>4.1.4</vertx-version>
+    <vertx-version>4.1.6</vertx-version>
     <vysper-version>0.7</vysper-version>
     <web3j-quorum-version>0.8.0</web3j-quorum-version>
     <web3j-version>3.6.0</web3j-version>
diff --git a/parent/pom.xml b/parent/pom.xml
index c1457bc..0ec751a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -541,7 +541,7 @@
         <vavr-version>0.10.2</vavr-version>
         <velocity-tools-version>3.1</velocity-tools-version>
         <velocity-version>2.3</velocity-version>
-        <vertx-version>4.1.4</vertx-version>
+        <vertx-version>4.1.6</vertx-version>
         <vysper-version>0.7</vysper-version>
         <web3j-version>3.6.0</web3j-version>
         <web3j-quorum-version>0.8.0</web3j-quorum-version>

[camel] 01/02: CAMEL-15133: camel-health - Make all consumers capable of providing custom health checks

Posted by da...@apache.org.
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

commit e6a215f016bc84bcc983c14b95546152fcd91900
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 4 11:03:14 2021 +0100

    CAMEL-15133: camel-health - Make all consumers capable of providing custom health checks
---
 core/camel-api/src/main/java/org/apache/camel/Route.java | 16 ++++++++--------
 .../src/main/java/org/apache/camel/spi/RouteError.java   |  8 ++++----
 .../org/apache/camel/impl/health/RouteHealthCheck.java   |  8 +++++---
 .../java/org/apache/camel/support/DefaultConsumer.java   | 15 ++++++++++++++-
 .../org/apache/camel/support/ScheduledPollConsumer.java  | 16 ++--------------
 5 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java b/core/camel-api/src/main/java/org/apache/camel/Route.java
index c34c2df..09ae0ea 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Route.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Route.java
@@ -182,22 +182,22 @@ public interface Route extends RuntimeConfiguration {
     void warmUp();
 
     /**
-     * Gets the last error that happened during changing the route lifecycle, i.e. such as when
-     * an exception was thrown during starting the route.
+     * Gets the last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown
+     * during starting the route.
      * <p/>
-     * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages
-     * with the Camel routing engine.
+     * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages with the
+     * Camel routing engine.
      *
      * @return the error
      */
     RouteError getLastError();
 
     /**
-     * Sets the last error that happened during changing the route lifecycle, i.e. such as when
-     * an exception was thrown during starting the route.
+     * Sets the last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown
+     * during starting the route.
      * <p/>
-     * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages
-     * with the Camel routing engine.
+     * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages with the
+     * Camel routing engine.
      *
      * @param error the error
      */
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RouteError.java b/core/camel-api/src/main/java/org/apache/camel/spi/RouteError.java
index 4130929..8d32b9a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/RouteError.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RouteError.java
@@ -17,11 +17,11 @@
 package org.apache.camel.spi;
 
 /**
- * The last error that happened during changing the route lifecycle, i.e. such as when
- * an exception was thrown during starting the route.
+ * The last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown during
+ * starting the route.
  * <p/>
- * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages
- * with the Camel routing engine.
+ * This is only errors for route lifecycle changes, it is not exceptions thrown during routing messsages with the Camel
+ * routing engine.
  */
 public interface RouteError {
 
diff --git a/core/camel-health/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java b/core/camel-health/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
index a6c6be0..e925c1d 100644
--- a/core/camel-health/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
+++ b/core/camel-health/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
@@ -22,6 +22,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Consumer;
 import org.apache.camel.Route;
 import org.apache.camel.ServiceStatus;
+import org.apache.camel.health.HealthCheck;
 import org.apache.camel.health.HealthCheckAware;
 import org.apache.camel.health.HealthCheckResultBuilder;
 import org.slf4j.Logger;
@@ -87,12 +88,13 @@ public class RouteHealthCheck extends AbstractHealthCheck {
             if (State.UP.equals(builder.state())) {
                 Consumer consumer = route.getConsumer();
                 if (consumer instanceof HealthCheckAware) {
-                    HealthCheckAware chc = (HealthCheckAware) consumer;
-                    if (chc.getHealthCheck() != null) {
+                    // health check is optional
+                    HealthCheck hc = ((HealthCheckAware) consumer).getHealthCheck();
+                    if (hc != null) {
                         if (LOGGER.isTraceEnabled()) {
                             LOGGER.trace("Calling HealthCheck on consumer route: {}", route.getId());
                         }
-                        Result result = chc.getHealthCheck().call();
+                        Result result = hc.call();
                         if (LOGGER.isDebugEnabled()) {
                             LOGGER.debug("HealthCheck consumer route: {} -> {}", route.getId(), result.getState());
                         }
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
index 8238f8c..ce2bf88 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultConsumer.java
@@ -27,6 +27,8 @@ import org.apache.camel.PooledExchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.RouteAware;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.health.HealthCheckAware;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.ExchangeFactory;
 import org.apache.camel.spi.RouteIdAware;
@@ -40,7 +42,7 @@ import org.slf4j.LoggerFactory;
 /**
  * A default consumer useful for implementation inheritance.
  */
-public class DefaultConsumer extends ServiceSupport implements Consumer, RouteAware, RouteIdAware {
+public class DefaultConsumer extends ServiceSupport implements Consumer, RouteAware, RouteIdAware, HealthCheckAware {
 
     private static final Logger LOG = LoggerFactory.getLogger(DefaultConsumer.class);
 
@@ -49,6 +51,7 @@ public class DefaultConsumer extends ServiceSupport implements Consumer, RouteAw
     private final Processor processor;
     private final AsyncProcessor asyncProcessor;
     private final ExchangeFactory exchangeFactory;
+    private HealthCheck healthCheck;
     private ExceptionHandler exceptionHandler;
     private Route route;
     private String routeId;
@@ -186,6 +189,16 @@ public class DefaultConsumer extends ServiceSupport implements Consumer, RouteAw
     }
 
     @Override
+    public void setHealthCheck(HealthCheck healthCheck) {
+        this.healthCheck = healthCheck;
+    }
+
+    @Override
+    public HealthCheck getHealthCheck() {
+        return healthCheck;
+    }
+
+    @Override
     protected void doBuild() throws Exception {
         LOG.debug("Build consumer: {}", this);
         ServiceHelper.buildService(exchangeFactory, processor);
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
index efe55e0..3d9ae15 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
@@ -29,7 +29,6 @@ import org.apache.camel.LoggingLevel;
 import org.apache.camel.PollingConsumerPollingStrategy;
 import org.apache.camel.Processor;
 import org.apache.camel.Suspendable;
-import org.apache.camel.health.HealthCheck;
 import org.apache.camel.health.HealthCheckAware;
 import org.apache.camel.spi.PollingConsumerPollStrategy;
 import org.apache.camel.spi.ScheduledPollConsumerScheduler;
@@ -47,7 +46,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer
 
     private static final Logger LOG = LoggerFactory.getLogger(ScheduledPollConsumer.class);
 
-    private HealthCheck healthCheck;
     private ScheduledPollConsumerScheduler scheduler;
     private ScheduledExecutorService scheduledExecutorService;
 
@@ -425,16 +423,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer
         this.scheduledExecutorService = scheduledExecutorService;
     }
 
-    @Override
-    public void setHealthCheck(HealthCheck healthCheck) {
-        this.healthCheck = healthCheck;
-    }
-
-    @Override
-    public HealthCheck getHealthCheck() {
-        return healthCheck;
-    }
-
     // Implementation methods
     // -------------------------------------------------------------------------
 
@@ -464,9 +452,9 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer
 
     @Override
     protected void doBuild() throws Exception {
-        if (healthCheck == null) {
+        if (getHealthCheck() == null) {
             String id = "consumer:" + getRouteId();
-            healthCheck = new ScheduledPollConsumerHealthCheck(this, id);
+            setHealthCheck(new ScheduledPollConsumerHealthCheck(this, id));
         }
     }