Apache Karaf

Karaf is a super-lightweight OSGi JAVA runtime, which means that, when it comes to deploying Camel routes, there is no JAVA code to write or compile. It also means that the runtime doesn't need to be restarted when camel routes change (unlike Tomcat or Jetty).

Karaf can be set up by downloading the software to $karaf.home (i.e. /opt/karaf), and then running $karaf.home/bin/karaf

This will enter the Karaf shell, at which point, the following commands will set up Camel and ActiveMQ:

$ feature:repo-add activemq
$ feature:repo-add camel 2.13.0
$ feature:install activemq
$ feature:install camel
$ feature:install camel-http4
$ feature:install camel-exec
$ feature:install camel-blueprint

(NB: a list of the supplied camel endpoints can be listed like so:)
$ features:list | grep -i camel

If you need to access a MySQL database, these commands would be helpful:

$ feature:install -s wrap:mvn:mysql/mysql-connector-java/5.1.30
$ feature:install camel-jdbc

To install karaf as a service, run this command in the karaf shell:

$ feature:install wrapper
$ wrapper:install

Depending on your OS, there may be some additional steps. If so, they will be described clearly on the Karaf console.

Once Karaf is running as a service, you can connect to the console with ssh:

$ ssh -p 8101 -l karaf localhost

Or, if you prefer more visually appealing interfaces, you can install hawtio

$ feature:repo-add hawtio 1.3.0
$ feature:install hawtio

and then connect to port 8181 with a web browser.

Once Karaf is set up, you can deploy camel routes by simply copying the route XML file into $karaf.home/deploy

karaf_runtime.txt · Last modified: 2014/09/19 09:56 by acoburn
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International