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 2023/07/25 11:39:16 UTC
[camel] branch camel-3.21.x updated: CAMEL-19646: camel-health - Routes controlled by superviser controller that is exhausted should report DOWN. (#10819)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.21.x by this push:
new 61497bfa2fe CAMEL-19646: camel-health - Routes controlled by superviser controller that is exhausted should report DOWN. (#10819)
61497bfa2fe is described below
commit 61497bfa2feb240e49b63b189492bdd9981178e8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jul 25 13:37:58 2023 +0200
CAMEL-19646: camel-health - Routes controlled by superviser controller that is exhausted should report DOWN. (#10819)
---
core/camel-api/src/main/java/org/apache/camel/Route.java | 1 +
.../impl/engine/DefaultSupervisingRouteController.java | 1 +
.../org/apache/camel/impl/health/RouteHealthCheck.java | 14 +++++++++-----
3 files changed, 11 insertions(+), 5 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 b2039689899..2491513ac7e 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
@@ -48,6 +48,7 @@ public interface Route extends RuntimeConfiguration {
String TEMPLATE_PROPERTY = "template";
String DESCRIPTION_PROPERTY = "description";
String CONFIGURATION_ID_PROPERTY = "configurationId";
+ String SUPERVISED = "supervised";
/**
* Gets the route id
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
index 19bb2e8cb00..224426ed443 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
@@ -826,6 +826,7 @@ public class DefaultSupervisingRouteController extends DefaultRouteController im
if (routes.add(holder)) {
holder.get().setRouteController(DefaultSupervisingRouteController.this);
holder.get().setAutoStartup(false);
+ holder.get().getProperties().put(Route.SUPERVISED, true); // mark route as being supervised
if (contextStarted.get()) {
LOG.debug("Context is already started: attempt to start route {}", route.getId());
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 2e6496c8f6e..df01bf5ef7e 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
@@ -56,11 +56,8 @@ public class RouteHealthCheck extends AbstractHealthCheck {
builder.message(String.format("Route %s has status %s", route.getId(), status.name()));
}
} else {
- if (!route.isAutoStartup()) {
- // if a route is configured to not to automatically start, then the
- // route is always up as it is externally managed.
- builder.up();
- } else if (route.getRouteController() == null) {
+ if (route.getRouteController() == null
+ && Boolean.TRUE == route.getProperties().getOrDefault(Route.SUPERVISED, Boolean.FALSE)) {
// the route has no route controller which mean it may be supervised and then failed
// all attempts and be exhausted, and if so then we are in unknown status
@@ -70,6 +67,13 @@ public class RouteHealthCheck extends AbstractHealthCheck {
if (route.getLastError() != null && route.getLastError().isUnhealthy()) {
builder.down();
}
+ } else if (!route.isAutoStartup()) {
+ // if a route is configured to not to automatically start, then the
+ // route is always up as it is externally managed.
+ builder.up();
+ } else {
+ // route in unknown state
+ builder.unknown();
}
}
}