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/09/18 15:53:34 UTC

[camel-spring-boot-examples] 11/40: health check

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

commit 066c0febd830a4b78a2f9f9a6963c131f0f485fb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 8 13:52:00 2020 +0200

    health check
---
 .../application/pom.xml                            | 111 ------------
 .../src/main/resources/application.properties      |  80 ---------
 camel-example-spring-boot-health-checks/pom.xml    |  61 ++++++-
 .../readme.adoc                                    | 199 +--------------------
 .../service/pom.xml                                |  89 ---------
 .../service/src/main/bash/consul-run-linux.sh      |  59 ------
 .../service/src/main/bash/consul-run-osx.sh        |  62 -------
 .../src/main/java/sample/service/Application.java  |  36 ----
 .../src/main/resources/application.properties      |  25 ---
 .../src/main/java/sample/camel/Application.java    |   0
 .../main/java/sample/camel/ApplicationCheck.java   |   0
 .../sample/camel/ApplicationConfiguration.java     |   8 +-
 .../src/main/resources/application.properties      |  54 +++---
 .../src/main/resources/application.properties      |   3 +
 14 files changed, 97 insertions(+), 690 deletions(-)

diff --git a/camel-example-spring-boot-health-checks/application/pom.xml b/camel-example-spring-boot-health-checks/application/pom.xml
deleted file mode 100644
index 945d877..0000000
--- a/camel-example-spring-boot-health-checks/application/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.camel.springboot.example</groupId>
-        <artifactId>camel-example-spring-boot-health-checks</artifactId>
-        <version>3.4.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>camel-example-spring-boot-health-checks-application</artifactId>
-    <name>Camel SB Examples :: Health Checks :: Application</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <spring.boot-version>${spring-boot-version}</spring.boot-version>
-    </properties>
-
-    <dependencyManagement>
-        <dependencies>
-            <!-- Spring Boot BOM -->
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring.boot-version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <!-- Camel BOM -->
-            <dependency>
-                <groupId>org.apache.camel.springboot</groupId>
-                <artifactId>camel-spring-boot-dependencies</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <!-- Spring Boot -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-tomcat</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-undertow</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-actuator</artifactId>
-        </dependency>
-        <!-- Camel -->
-        <dependency>
-            <groupId>org.apache.camel.springboot</groupId>
-            <artifactId>camel-spring-boot-starter</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.springboot</groupId>
-            <artifactId>camel-stream-starter</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.springboot</groupId>
-            <artifactId>camel-consul-starter</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring-boot-version}</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
diff --git a/camel-example-spring-boot-health-checks/application/src/main/resources/application.properties b/camel-example-spring-boot-health-checks/application/src/main/resources/application.properties
deleted file mode 100644
index 15d0eb8..0000000
--- a/camel-example-spring-boot-health-checks/application/src/main/resources/application.properties
+++ /dev/null
@@ -1,80 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-debug = false
-
-logging.level.org.springframework = INFO
-logging.level.org.apache.camel.spring.boot = INFO
-logging.level.org.apache.camel.health = DEBUG
-logging.level.org.apache.camel.impl.health = DEBUG
-logging.level.sample.camel = DEBUG
-
-management.endpoints.enabled-by-default = false
-management.endpoint.mappings.enabled = true
-management.endpoint.health.enabled = true
-management.endpoint.camelhealthchecks.enabled = true
-
-camel.springboot.name = SampleHealthChecks
-
-################################################################################
-#
-# health checks
-#
-################################################################################
-
-# Enable camel health indicator
-camel.health.indicator.enabled = true
-
-# Enable camel HealthCheck integration with spring's health indicator.
-camel.health.check.indicator.enabled = true
-
-# Enable camel HealthCheck for routes.
-camel.health.check.routes.enabled = true
-camel.health.check.routes.thresholds.exchanges-failed = 10
-camel.health.check.routes.threshold[bar].exchanges-failed = 20
-camel.health.check.routes.threshold[slow].inherit = false
-camel.health.check.routes.threshold[slow].last-processing-time.threshold = 1000
-camel.health.check.routes.threshold[slow].last-processing-time.failures = 5
-
-# HealthChecks can be pulled out from SpringBoot's health endpoint using either
-# the literal id or a regexp. Exclusion list can be applied to both the ID or the
-# Group as shown below:
-#
-#camel.health.check.indicator.exclusion.ids[0] = my-.*-2
-#camel.health.check.indicator.exclusion.groups[0] = global
-
-# Without the HealthCheckService running each invocation to either the Camel's
-# health check endpoint or SpringBoot's one results in an invocation of the check
-# whereas when enables, all the responses are cached until the check timeout is
-# reached or the invocation is forced.
-#
-#camel.health.check.service.enabled = true
-#camel.health.check.service.check-interval = 10000
-
-################################################################################
-#
-# Consul repository
-#
-# Make consul checks identified by http and file available to camel
-#
-################################################################################
-
-camel.component.consul.health.check.repository.enabled = true
-camel.component.consul.health.check.repository.url = http://localhost:8500
-camel.component.consul.health.check.repository.checks[0] = http
-camel.component.consul.health.check.repository.checks[1] = file
-
diff --git a/camel-example-spring-boot-health-checks/pom.xml b/camel-example-spring-boot-health-checks/pom.xml
index ca6c6a5..f5dc7cb 100644
--- a/camel-example-spring-boot-health-checks/pom.xml
+++ b/camel-example-spring-boot-health-checks/pom.xml
@@ -29,20 +29,65 @@
 
     <artifactId>camel-example-spring-boot-health-checks</artifactId>
     <name>Camel SB Examples :: Health Checks</name>
-    <description>An example showing how to work with Camel's Health Checks and Spring Boot</description>
-    <packaging>pom</packaging>
 
     <properties>
-        <category>Beginner</category>
-
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <spring.boot-version>${spring-boot-version}</spring.boot-version>
     </properties>
 
+    <dependencyManagement>
+        <dependencies>
+            <!-- Spring Boot BOM -->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring.boot-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <!-- Camel BOM -->
+            <dependency>
+                <groupId>org.apache.camel.springboot</groupId>
+                <artifactId>camel-spring-boot-dependencies</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!-- Spring Boot -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-actuator</artifactId>
+        </dependency>
+        <!-- Camel -->
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-stream-starter</artifactId>
+        </dependency>
+    </dependencies>
 
-    <modules>
-        <module>service</module>
-        <module>application</module>
-    </modules>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot-version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/camel-example-spring-boot-health-checks/readme.adoc b/camel-example-spring-boot-health-checks/readme.adoc
index 2641562..aede7b3 100644
--- a/camel-example-spring-boot-health-checks/readme.adoc
+++ b/camel-example-spring-boot-health-checks/readme.adoc
@@ -6,209 +6,22 @@ NOTE: Some of the routes fail intentionally to have health check monitor their f
 
 === How to run
 
-* mvn clean package
-* service/src/main/bash/consul-run-linux.sh
-* mvn -pl service spring-boot:run
-* mvn -pl application spring-boot:run
-
-=== How to play with the example
-
-You can interact with the example using curl or httpie
-
-* Trigger the checks an gather the results:
-+
-[source,console]
-----
-$ http -b GET localhost:8080/camel/health/check
-----
-+
-[source,json]
-----
-[
-    {
-        "check": {
-            "id": "consul-file"
-        },
-        "status": "UP"
-    },
-    {
-        "check": {
-            "id": "consul-http"
-        },
-        "status": "UP"
-    },
-    {
-        "check": {
-            "group": "global",
-            "id": "my-check-1"
-        },
-        "status": "UP"
-    },
-    {
-        "check": {
-            "group": "local",
-            "id": "my-check-2"
-        },
-        "status": "UP"
-    }
-]
-----
-
-* Query the status of a named check
-+
-[source,console]
-----
-$ http -b GET localhost:8080/camel/health/check/consul-http
-----
-+
-[source,json]
-----
-{
-    "check": {
-        "configuration": {
-            "enabled": true,
-            "failureThreshold": 0,
-            "interval": "PT0S"
-        },
-        "id": "consul-http",
-        "metaData": {
-            "check.id": "consul-http",
-            "failure.count": 0,
-            "invocation.attempt.time": "2017-08-29T10:03:10.292+02:00[Europe/Rome]",
-            "invocation.count": 3,
-            "invocation.time": "2017-08-29T10:03:10.292+02:00[Europe/Rome]"
-        }
-    },
-    "details": {
-        "consul.check.id": "http",
-        "consul.check.status": "passing",
-        "consul.service.id": "",
-        "consul.service.name": "",
-        "failure.count": 0,
-        "invocation.count": 3,
-        "invocation.time": "2017-08-29T10:03:10.292+02:00[Europe/Rome]"
-    },
-    "status": "UP"
-}
-----
-+
-IMPORTANT: This call may result in a direct invocation of the check, the behavior is implementation dependant.
-
-
-* Trigger a named check
-+
 [source,console]
 ----
-$ http -b GET localhost:8080/camel/health/check/consul-http/invoke
-----
-+
-[source,json]
-----
-{
-    "check": {
-        "configuration": {
-            "enabled": true,
-            "failureThreshold": 0,
-            "interval": "PT0S"
-        },
-        "id": "consul-http",
-        "metaData": {
-            "check.id": "consul-http",
-            "failure.count": 0,
-            "invocation.attempt.time": "2017-08-29T10:05:02.729+02:00[Europe/Rome]",
-            "invocation.count": 14,
-            "invocation.time": "2017-08-29T10:05:02.729+02:00[Europe/Rome]"
-        }
-    },
-    "details": {
-        "consul.check.id": "http",
-        "consul.check.status": "passing",
-        "consul.service.id": "",
-        "consul.service.name": "",
-        "failure.count": 0,
-        "invocation.count": 14,
-        "invocation.time": "2017-08-29T10:05:02.729+02:00[Europe/Rome]"
-    },
-    "status": "UP"
-}
+mvn compile spring-boot:run
 ----
 
-* Check the application status using Spring-Boot's health endpoint:
-+
-[source,console]
-----
-$ http -b GET localhost:8080/health
-----
-+
-[source,json]
-----
-{
-    "camel": {
-        "contextStatus": "Started",
-        "name": "SampleHealthChecks",
-        "status": "UP",
-        "version": "2.20.0-SNAPSHOT"
-    },
-    "camel-health-checks": {
-        "consul-file": "UP",
-        "consul-http": "UP",
-        "my-check-1": "UP",
-        "my-check-2": "UP",
-        "status": "UP"
-    },
-    "diskSpace": {
-        "free": 120546111488,
-        "status": "UP",
-        "threshold": 10485760,
-        "total": 192459673600
-    },
-    "status": "UP"
-}
-----
+=== Health Check
 
-If you stop the `service` application, the Spring-Boot's health endpoint will report the `application` as un-healthy:
+You can query the health check of the application using Spring Boot actuator:
 
 [source,console]
 ----
-$ http -b GET localhost:8080/health
-----
-
-[source,json]
-----
-{
-    "camel": {
-        "contextStatus": "Started",
-        "name": "SampleHealthChecks",
-        "status": "UP",
-        "version": "2.20.0-SNAPSHOT"
-    },
-    "camel-health-checks": {
-        "consul-file": "UP",
-        "consul-http": "UP",
-        "my-check-1": "UP",
-        "my-check-2": "UP",
-        "status": "DOWN"
-    },
-    "diskSpace": {
-        "free": 120546017280,
-        "status": "UP",
-        "threshold": 10485760,
-        "total": 192459673600
-    },
-    "status": "DOWN"
-}
+$ http://localhost:8080/actuator/health
 ----
 
-=== Using the HealthCheckService
-
-The HealthCheckService can be enabled by setting the property `camel.health.check.service.enabled` to `true`. Once done every call to the Camel health check endpoint as well as the SpringBoot one will return the last known response or an error if the requested check has not yet been invoked.
-
-To force the service to refresh a check, you can use:
-
-[source,console]
-----
-$ http -b GET localhost:8080/camel/health/check/{id}/invoke
-----
+The returned response should include the health checks from Apache Camel,
+and as well two custom checks.
 
 === Help and contributions
 
diff --git a/camel-example-spring-boot-health-checks/service/pom.xml b/camel-example-spring-boot-health-checks/service/pom.xml
deleted file mode 100644
index aca716e..0000000
--- a/camel-example-spring-boot-health-checks/service/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.camel.springboot.example</groupId>
-        <artifactId>camel-example-spring-boot-health-checks</artifactId>
-        <version>3.4.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>camel-example-spring-boot-health-checks-service</artifactId>
-    <name>Camel SB Examples :: Health Checks :: Service</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <spring.boot-version>${spring-boot-version}</spring.boot-version>
-    </properties>
-
-    <dependencyManagement>
-        <dependencies>
-            <!-- Spring Boot BOM -->
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring.boot-version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-tomcat</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-undertow</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring-boot-version}</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
diff --git a/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh b/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
deleted file mode 100755
index 58e8b56..0000000
--- a/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-linux.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-
-CONSUL_VER="1.0.8"
-CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip"
-
-# cleanup
-rm -rf "target/consul-data"
-rm -rf "target/consul-config"
-rm -rf "target/consul"
-
-mkdir -p target/
-mkdir -p target/consul-data
-mkdir -p target/consul-config
-
-if [ ! -f target/${CONSUL_ZIP} ]; then
-    wget "https://releases.hashicorp.com/consul/${CONSUL_VER}/${CONSUL_ZIP}" -O target/${CONSUL_ZIP}
-fi
-
-cat > target/consul-config/checks.json <<EOF
-{
-  "checks": [{
-    "id": "http", "script": "curl www.google.com >/dev/null 2>&1", "interval": "10s"
-  }, {
-    "id": "file", "script": "ls /tmp/camel-check >/dev/null 2>&1", "interval": "10s"
-  }]
-}
-EOF
-
-unzip -d target target/${CONSUL_ZIP}
-
-target/consul \
-    agent \
-    -server \
-    -bootstrap \
-    -datacenter camel \
-    -advertise 127.0.0.1 \
-    -bind 0.0.0.0 \
-    -log-level trace \
-    -data-dir target/consul-data \
-    -config-dir target/consul-config \
-    -enable-script-checks \
-    -ui
diff --git a/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh b/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
deleted file mode 100755
index a4241c6..0000000
--- a/camel-example-spring-boot-health-checks/service/src/main/bash/consul-run-osx.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-
-CONSUL_VER="1.0.8"
-CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip"
-
-# cleanup
-rm -rf "target/consul-data"
-rm -rf "target/consul-config"
-rm -rf "target/consul"
-
-mkdir -p target/
-mkdir -p target/consul-data
-mkdir -p target/consul-config
-
-
-if [ ! -f target/$CONSUL_ZIP ]; then
-    echo Downloading: https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP 
-    curl -o target/$CONSUL_ZIP "https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP"
-fi
-
-cat > target/consul-config/checks.json <<EOF
-{
-  "checks": [{
-    "id": "http", "script": "curl www.google.com >/dev/null 2>&1", "interval": "10s"
-  }, {
-    "id": "file", "script": "ls /tmp/camel-check >/dev/null 2>&1", "interval": "10s"
-  }]
-}
-EOF
-
-unzip -d target target/$CONSUL_ZIP
-chmod +x target/consul
-
-target/consul \
-    agent \
-    -server \
-    -bootstrap \
-    -datacenter camel \
-    -advertise 127.0.0.1 \
-    -bind 0.0.0.0 \
-    -log-level trace \
-    -data-dir target/consul-data \
-    -config-dir target/consul-config \
-    -enable-script-checks \
-    -ui
diff --git a/camel-example-spring-boot-health-checks/service/src/main/java/sample/service/Application.java b/camel-example-spring-boot-health-checks/service/src/main/java/sample/service/Application.java
deleted file mode 100644
index 41b7a2d..0000000
--- a/camel-example-spring-boot-health-checks/service/src/main/java/sample/service/Application.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package sample.service;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-//CHECKSTYLE:OFF
-/**
- * A sample Spring Boot application that starts the Camel routes.
- */
-@SpringBootApplication
-public class Application {
-    /**
-     * A main method to start this application.
-     */
-    public static void main(String[] args) {
-        SpringApplication.run(Application.class, args);
-    }
-}
-//CHECKSTYLE:ON
-
diff --git a/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties b/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties
deleted file mode 100644
index 03aa57e..0000000
--- a/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-debug = false
-
-logging.level.org.springframework = INFO
-
-server.port = 8081
-
-management.endpoints.enabled-by-default = false
-management.endpoint.health.enabled = true
diff --git a/camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/Application.java b/camel-example-spring-boot-health-checks/src/main/java/sample/camel/Application.java
similarity index 100%
rename from camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/Application.java
rename to camel-example-spring-boot-health-checks/src/main/java/sample/camel/Application.java
diff --git a/camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/ApplicationCheck.java b/camel-example-spring-boot-health-checks/src/main/java/sample/camel/ApplicationCheck.java
similarity index 100%
rename from camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/ApplicationCheck.java
rename to camel-example-spring-boot-health-checks/src/main/java/sample/camel/ApplicationCheck.java
diff --git a/camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/ApplicationConfiguration.java b/camel-example-spring-boot-health-checks/src/main/java/sample/camel/ApplicationConfiguration.java
similarity index 87%
rename from camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/ApplicationConfiguration.java
rename to camel-example-spring-boot-health-checks/src/main/java/sample/camel/ApplicationConfiguration.java
index 5131af9..aff4530 100644
--- a/camel-example-spring-boot-health-checks/application/src/main/java/sample/camel/ApplicationConfiguration.java
+++ b/camel-example-spring-boot-health-checks/src/main/java/sample/camel/ApplicationConfiguration.java
@@ -23,16 +23,20 @@ import org.springframework.context.annotation.Configuration;
 
 @Configuration
 public class ApplicationConfiguration {
+
     @Bean
     public RouteBuilder routesBuilder() {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("timer:foo?period=1000")
+                // to be less verbose
+                errorHandler(defaultErrorHandler().logStackTrace(false).logExhaustedMessageHistory(false).logExhausted(false));
+
+                from("timer:foo?bridgeErrorHandler=true&period=4000")
                     .routeId("foo")
                     .process(e -> {
                         throw new RuntimeCamelException("This is a forced exception to have health check monitor this failure (route=foo)"); 
                     });
-                from("timer:bar?period=1000")
+                from("timer:bar?bridgeErrorHandler=true&period=5000")
                     .routeId("bar")
                     .process(e -> {
                         throw new RuntimeCamelException("This is a forced exception to have health check monitor this failure (route=bar)");
diff --git a/camel-example-spring-boot/src/main/resources/application.properties b/camel-example-spring-boot-health-checks/src/main/resources/application.properties
similarity index 56%
copy from camel-example-spring-boot/src/main/resources/application.properties
copy to camel-example-spring-boot-health-checks/src/main/resources/application.properties
index 7ec89a3..2a89be8 100644
--- a/camel-example-spring-boot/src/main/resources/application.properties
+++ b/camel-example-spring-boot-health-checks/src/main/resources/application.properties
@@ -15,24 +15,13 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-# the name of Camel
-camel.springboot.name = MyCamel
+debug = false
 
-# what to say
-greeting = Hello World
-
-# how often to trigger the timer (millis)
-myPeriod = 2000
-
-# to watch bean introspection using java reflection usage
-# camel.springboot.bean-introspection-logging-level=INFO
-
-# to automatic shutdown the JVM after a period of time
-#camel.springboot.duration-max-seconds=60
-#camel.springboot.duration-max-messages=100
-
-# add for example: &repeatCount=5 to the timer endpoint to make Camel idle
-#camel.springboot.duration-max-idle-seconds=15
+logging.level.org.springframework = INFO
+logging.level.org.apache.camel.spring.boot = INFO
+logging.level.org.apache.camel.health = DEBUG
+logging.level.org.apache.camel.impl.health = DEBUG
+logging.level.sample.camel = DEBUG
 
 # expose actuator endpoint via HTTP
 management.endpoints.web.exposure.include=info,health
@@ -40,13 +29,28 @@ management.endpoints.web.exposure.include=info,health
 # show verbose health details (/actuator/health) so you can see Camel information also
 management.endpoint.health.show-details=always
 
-# to turn off Camel info in (/actuator/info)
-management.info.camel.enabled=true
-management.info.camel.verbose=true
+camel.springboot.name = SampleHealthChecks
+
+################################################################################
+#
+# health checks
+#
+################################################################################
+
+# Enable camel health check
+camel.health.enabled = true
+
+# Enable camel HealthCheck for routes.
+camel.health.routes-enabled = true
+
+# fine grained configuration for foo route
+camel.health.config[foo].parent=routes
+camel.health.config[foo].interval=10000
+camel.health.config[foo].failure-threshold=5
+
+# fine grained configuration for bar route
+camel.health.config[bar].parent=routes
+camel.health.config[bar].interval=10000
+camel.health.config[bar].failure-threshold=10
 
-# to configure logging levels
-#logging.level.org.springframework = INFO
-#logging.level.org.apache.camel.spring.boot = INFO
-#logging.level.org.apache.camel.impl = DEBUG
-#logging.level.sample.camel = DEBUG
 
diff --git a/camel-example-spring-boot/src/main/resources/application.properties b/camel-example-spring-boot/src/main/resources/application.properties
index 7ec89a3..c6342b5 100644
--- a/camel-example-spring-boot/src/main/resources/application.properties
+++ b/camel-example-spring-boot/src/main/resources/application.properties
@@ -34,6 +34,9 @@ myPeriod = 2000
 # add for example: &repeatCount=5 to the timer endpoint to make Camel idle
 #camel.springboot.duration-max-idle-seconds=15
 
+camel.health.registry-enabled = false
+camel.health[routes][timer].enabled = true
+
 # expose actuator endpoint via HTTP
 management.endpoints.web.exposure.include=info,health