Skip to content

Latest commit

 

History

History
 
 

health

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Health: A Camel Quarkus example

{cq-description} It also shows how you can build custom health-checks and have them automatic discovered by Camel and used as parts of its health-check system.

Tip
Check the Camel Quarkus User guide for prerequisites and other general information.

The example has two routes. The timer route performs a given task at regular interval. For the sake of this example we’ll say that this task unexpectedly freezes the service from time to time. The details can be consulted at http://localhost:8080/q/health. The custom health check is expected to report UNKNOWN on first consultation, then UP during 10 seconds, and finally DOWN so as to simulate that the service is frozen.

The 2nd route is on purpose made to fail on startup by configuring netty to an unknown host. Camel supervising route controller will attempt to restart the route up till 10 times before exhausting. The routes health check will therefore report this route as DOWN until its exhausted where the states are changed to UNKNOWN.

The details can be seen at runtime via the following url from a web browser: http://localhost:8080/q/health.

Start in the Development mode

$ mvn clean compile quarkus:dev

The above command compiles the project, starts the application and lets the Quarkus tooling watch for changes in your workspace. Any modifications in your project will automatically take effect in the running application.

Tip
Please refer to the Development mode section of Camel Quarkus User guide for more details.

You can check the health check status by calling the following url from a web browser: http://localhost:8080/q/health

Package and run the application

Once you are done with developing you may want to package and run the application.

Tip
Find more details about the JVM mode and Native mode in the Package and run section of Camel Quarkus User guide

JVM mode

$ mvn clean package
$ java -jar target/quarkus-app/quarkus-run.jar
...
[io.quarkus] (main) camel-quarkus-examples-... started in 0.885s. Listening on: http://0.0.0.0:8080

Native mode

Important
Native mode requires having GraalVM and other tools installed. Please check the Prerequisites section of Camel Quarkus User guide.

To prepare a native executable using GraalVM, run the following command:

$ mvn clean package -Pnative
$ ./target/*-runner
...
[io.quarkus] (main) camel-quarkus-examples-... started in 0.026s. Listening on: http://0.0.0.0:8080
...

Feedback

Please report bugs and propose improvements via GitHub issues of Camel Quarkus project.