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 6747edf camel-health - Route health check that are no longer
supervised due exhausted should be in UNKNOWN state and not UP
6747edf is described below
commit 6747edf525f513ebe4d51d2fc79f1c35a6de5091
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri May 29 21:34:54 2020 +0200
camel-health - Route health check that are no longer supervised due
exhausted should be in UNKNOWN state and not UP
---
.../apache/camel/impl/health/RouteHealthCheck.java | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
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 0693537..35eed21 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,14 +22,11 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Route;
import org.apache.camel.ServiceStatus;
import org.apache.camel.health.HealthCheckResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* {@link org.apache.camel.health.HealthCheck} for a given route.
*/
public class RouteHealthCheck extends AbstractHealthCheck {
- private static final Logger LOGGER =
LoggerFactory.getLogger(RouteHealthCheck.class);
private final Route route;
@@ -56,16 +53,15 @@ public class RouteHealthCheck extends AbstractHealthCheck {
builder.message(String.format("Route %s has status %s",
route.getId(), status.name()));
}
} else {
- LOGGER.debug("Route {} marked as UP (controlled={},
auto-startup={})",
- route.getId(),
- route.getRouteController() != null,
- route.isAutoStartup()
- );
-
- // Assuming that if no route controller is configured or if a
- // route is configured to not to automatically start, then the
- // route is always up as it is externally managed.
- builder.up();
+ 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) {
+ // 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
+ builder.unknown();
+ }
}
}
}