Karaf Support
Apache Camel is designed to work nicely into Apache Karaf OSGi container.
It includes:
- Camel features descriptor allowing to easily and quickly install Camel in Karaf.
- Karaf commands allowing you to view, start, stop, get info, about the Camel contexts and routes running in the Karaf instance. NB: Karaf commands are available starting with Camel 2.8.0.
Install Camel in Karaf
Assuming that you have a running Karaf instance, you can register the Camel features descriptor:
karaf@root> features:addurl mvn:org.apache.camel.karaf/apache-camel/2.8.0/xml/features
Now, we have all Camel features available:
karaf@root> features:list|grep -i camel [uninstalled] [2.8.0 ] camel repo-0 [uninstalled] [2.8.0 ] camel-core repo-0 [uninstalled] [2.8.0 ] camel-spring repo-0 [uninstalled] [2.8.0 ] camel-blueprint repo-0 [uninstalled] [2.8.0 ] camel-test repo-0 [uninstalled] [2.8.0 ] camel-cxf repo-0 [uninstalled] [2.8.0 ] camel-cache repo-0 [uninstalled] [2.8.0 ] camel-castor repo-0 [uninstalled] [2.8.0 ] camel-crypto repo-0 [uninstalled] [2.8.0 ] camel-http repo-0 [uninstalled] [2.8.0 ] camel-http4 repo-0 [uninstalled] [2.8.0 ] camel-mina repo-0 [uninstalled] [2.8.0 ] camel-jetty repo-0 [uninstalled] [2.8.0 ] camel-servlet repo-0 [uninstalled] [2.8.0 ] camel-jms repo-0 ...
To install Camel, just install the camel feature:
karaf@root> features:install camel
You have to install the Camel features depending of your requirements.
For instance, if you want to use blueprint as Camel DSL, you have to install the camel-blueprint feature:
karaf@root> features:install camel-blueprint
If, if your route, you use an endpoint like "stream:out", you have to install the camel-stream feature:
karaf@root> features:install camel-stream
Karaf commands
When you install the camel feature, new Karaf commands become available automatically.
camel:list-contexts
The *camel:list-contexts* command displays the list of CamelContext available in the current Karaf instance:
karaf@root> camel:list-contexts Name Status Uptime [66-camel-3 ] [Started ] [14.559 seconds ]
It displays the context name/ID (used in others commands), the current status (started/stopped), the uptime (since when the context has been started).
camel:list-routes
The *camel:list-routes* command displays the list of Camel routes available in the current Karaf instance:
karaf@root> camel:list-routes [route1 ]
You can also filter the routes by CamelContext:
karaf@root> camel:list-routes 66-camel-3 [route1 ]
Tip: use the TAB key to completion on the CamelContext ID.