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-examples.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f71414  Polished
8f71414 is described below

commit 8f71414caaa2a80b2c354bf0c3187738fef076b7
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri May 29 21:35:14 2020 +0200

    Polished
---
 examples/camel-example-main-health/pom.xml                         | 4 ++++
 .../src/main/java/org/apache/camel/example/MyRouteBuilder.java     | 7 ++++++-
 .../src/main/resources/application.properties                      | 6 +++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/examples/camel-example-main-health/pom.xml 
b/examples/camel-example-main-health/pom.xml
index e41e0d6..95320ea 100644
--- a/examples/camel-example-main-health/pom.xml
+++ b/examples/camel-example-main-health/pom.xml
@@ -67,6 +67,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-quartz</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-netty</artifactId>
+        </dependency>
 
         <!-- logging -->
         <dependency>
diff --git 
a/examples/camel-example-main-health/src/main/java/org/apache/camel/example/MyRouteBuilder.java
 
b/examples/camel-example-main-health/src/main/java/org/apache/camel/example/MyRouteBuilder.java
index e42df41..a5baa36 100644
--- 
a/examples/camel-example-main-health/src/main/java/org/apache/camel/example/MyRouteBuilder.java
+++ 
b/examples/camel-example-main-health/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -27,8 +27,13 @@ public class MyRouteBuilder extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        from("quartz:foo?cron={{myCron}}").routeId("foo")
+        from("quartz:foo?cron={{myCron}}").routeId("quartz")
             .bean(monkey, "chaos")
             .log("${body}");
+
+        // this route is invalid and fails during startup
+        // the supervising route controller will take over and attempt
+        // to restart this route
+        from("netty:tcp:unknownhost").to("log:dummy").routeId("netty");
     }
 }
diff --git 
a/examples/camel-example-main-health/src/main/resources/application.properties 
b/examples/camel-example-main-health/src/main/resources/application.properties
index 67fc988..0900958 100644
--- 
a/examples/camel-example-main-health/src/main/resources/application.properties
+++ 
b/examples/camel-example-main-health/src/main/resources/application.properties
@@ -22,8 +22,12 @@ camel.main.name = MyHealthyCamel
 # enable JMX which allows to also control health check
 camel.main.jmx-enabled = true
 
-# enable health check (is automatic enabled if discovered on classpath)
+# enable supervised route controller which will startup routes in safe manner
 camel.main.route-controller-supervise-enabled = true
+# attempt up till 10 times to start a route (and exhaust if still failing)
+camel.main.route-controller-back-off-max-attempts = 10
+
+# enable health check (is automatic enabled if discovered on classpath)
 camel.main.health-check-enabled = true
 camel.main.health-check-routes-enabled = true
 

Reply via email to