Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc

Spring Boot Example

The Spring Boot example shows how to work with the simple Camel application based on Spring Boot.

The example generates messages using timer trigger, writes them to standard output and the mock endpoint (for testing purposes).

This example exposes Jolokia API and Spring Boot actuators endpoints (like metrics) via the webmvc endpoint. We consider this as best practice - Spring Boot applications with these APIs exposed can be easily monitored and managed by 3rd party tools. We also recommend to package your application as a fat WAR. Fat WARs can be executed just as regular fat jars, but you can also deploy them to the servlet containers like Tomcat. The "Fat WAR approach" offers you deployment flexibility, so we highly recommend it.

You will need to compile this example first:

  mvn install

To run the example type:

mvn spring-boot:run

You can also execute the fat WAR directly:

java -jar target/camel-example-spring-boot.war

You will see the message printed to the console every second. To stop the example hit Ctrl + C.

From Camel 2.17 the example ships with remote shell enabled which includes the Camel commands as well, so you can SSH into the running Camel application and use the camel commands to list / stop routes etc.

ssh -p 2000 user@localhost
 
# use the password that spring-boot logs when it startup
> camel route-list camel-1
 Context        Route          Status              Total #       Failed #     Inflight #   Uptime
 -------        -----          ------              -------       --------     ----------   ------
 camel-1        route1         Started                  71              0              0   1 minute
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram