# Camel Health Checks and Spring Boot

This example shows how to work with a simple Apache Camel application using Spring Boot.

NOTE: Some of the routes fail intentionally to have health check monitor their failures

## How to run

* mvn clean package
* mvn spring-boot:run

### How to play with the example

You can interact with the example using curl or http

* Trigger the checks an gather the results:
+
[source,console]
----
$ http -b GET localhost:8080/actuator/health/camel
----
+
[source,json]
----
{
	"status": "UP",
	"details": {
		"name": "SampleHealthChecks",
		"version": "2.23.2-SNAPSHOT",
		"uptime": "17.329 seconds",
		"uptimeMillis": 17329,
		"status": "Started"
	}
}
----

### Get Routes informations

* Get generic informations of all routes

+
[source,console]
----
$ http -b GET localhost:8080/actuator/camelroutes
----
+
[source,json]
----
[{
	"id": "foo",
	"uptime": "8 minutes",
	"uptimeMillis": 486551,
	"properties": {
		"parent": "4997552e",
		"rest": "false",
		"description": null,
		"id": "foo"
	},
	"status": "Started"
}, {
	"id": "bar",
	"uptime": "8 minutes",
	"uptimeMillis": 486550,
	"properties": {
		"parent": "9c73fff",
		"rest": "false",
		"description": null,
		"id": "bar"
	},
	"status": "Started"
}, {
	"id": "slow",
	"uptime": "8 minutes",
	"uptimeMillis": 486549,
	"properties": {
		"parent": "2abbd0d9",
		"rest": "false",
		"description": null,
		"id": "slow"
	},
	"status": "Started"
}]

----

* Query the details of a specific route
+
[source,console]
----
$ http -b GET localhost:8080/actuator/camelroutes/foo/detail
----
+
[source,json]
----
{
	"id": "foo",
	"uptime": "10 minutes",
	"uptimeMillis": 615487,
	"properties": {
		"parent": "4997552e",
		"rest": "false",
		"description": null,
		"id": "foo"
	},
	"status": "Started",
	"details": {
		"deltaProcessingTime": -1,
		"exchangesInflight": 0,
		"exchangesTotal": 62,
		"exchangesFailed": 0,
		"externalRedeliveries": 0,
		"failuresHandled": 62,
		"firstExchangeCompletedExchangeId": "ID-localhost-1624288561578-0-1",
		"firstExchangeCompletedTimestamp": "2021-06-21T15:16:03.574+00:00",
		"lastExchangeCompletedExchangeId": "ID-localhost-1624288561578-0-754",
		"lastExchangeCompletedTimestamp": "2021-06-21T15:26:13.566+00:00",
		"lastProcessingTime": 0,
		"maxProcessingTime": 8,
		"meanProcessingTime": 0,
		"minProcessingTime": 0,
		"redeliveries": 0,
		"totalProcessingTime": 36,
		"hasRouteController": false
	}
}
----

## More information

You can find more information about Apache Camel at the website: http://camel.apache.org/
