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, and the commands was renamed in Camel 2.9.0.

Here are the versions that are compatible.

Camel Version

Karaf Version

2.2.0

1.2.0

2.3.0

1.3.0

2.4.0

1.4.0

2.5.0

2.1.0

2.7.0

2.2.0

2.7.2

2.2.2

2.8.2

2.2.4

2.9.0

2.2.5

2.10.0

2.2.8

2.11.0

2.3.1

2.12.0

2.3.2

2.13.02.3.3
2.14.02.3.7

Preparing Karaf for Camel

Camel uses several bundles to provide low level package, such as javax.annotation or javax.xml.bind.

Due to that, we mustn't use the default system package coming from the JDK. It means that we need to "exclude" some packages from system packages in order to use packages provided by tiers bundles.

Camel provides a ready to use config.properties file that you can download:

http://svn.apache.org/repos/asf/camel/tags/camel-2.7.2/platforms/karaf/features/src/main/resources/config.properties

This file has to be copied into Karaf etc folder.

Karaf 2.2.5 or newer

Icon

Notice that Karaf 2.2.5 now provides an extra configuration file that has been configured to work with Camel and CXF, so its recommended to use this file if you use Karaf 2.2.5 or newer. You can prepare Karaf by copying the etc/jre.properties.cxf and override the existing etc/jre.properties file.

Install Camel in Karaf

Assuming that you have a running Karaf instance, you can register the Camel features descriptor:

From Karaf 2.2.6 onwards this has been simplified as there is a new features:chooseurl command that is pre-setup for Camel

Now, we have all Camel features available:

To install Camel, just install the camel feature:

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:

If, if your route, you use an endpoint like "stream:out", you have to install the camel-stream feature:

Karaf commands

When you install the camel feature, new Karaf commands become available automatically.

Karaf commands in Camel 2.8.x

Command

Description

camel:list-contexts

Lists the camel contexts available in the current Karaf instance

camel:list-routes

Displays the list of Camel routes available in the current Karaf instance

camel:info-context

Displays detail information about a given Camel context

camel:start-context

Starts the given Camel context

camel:stop-context

Stops the given Camel context

camel:info-route

Provides detail information about a Camel route

camel:show-route

Renders the route in XML

camel:start-route

Starts the given route.

camel:stop-route

Stops the given route.

Karaf commands in Camel 2.9 onwards

Command

Description

camel:context-list

Lists the camel contexts available in the current Karaf instance

camel:context-info

Displays detail information about a given Camel context

camel:context-start

Starts the given Camel context

camel:context-stop

Stops the given Camel context (it becomes unavailable and it can't be started afterwards)

camel:route-list

Displays the list of Camel routes available in the current Karaf instance

camel:route-info

Provides detail information about a Camel route

camel:route-show

Renders the route in XML

camel:route-start

Starts the given route. From Camel 2.10 onwards you can use * as wildcard to match multiple routes.

camel:route-stop

Stops the given route. From Camel 2.10 onwards you can use * as wildcard to match multiple routes.

camel:route-suspend

Suspends the given route. From Camel 2.10 onwards you can use * as wildcard to match multiple routes.

camel:route-resume

Resumes the given route. From Camel 2.10 onwards you can use * as wildcard to match multiple routes.

Karaf commands in Camel 2.10 onwards

Command

Description

camel:endpoint-list

Lists endpoints fromm all camel contexts available in the current Karaf instance

Karaf commands in Camel 2.11 onwards

Command

Description

camel:backlog-tracer-info

Provides detail information about the BacklogTracer

camel:backlog-tracer-dump

To dump tracing on the console from the BacklogTracer

camel:backlog-tracer-start

To start the BacklogTracer on route(s)

camel:backlog-tracer-stop

To stop the BacklogTracer on route(s)

camel:route-profile

To profile route(s)

camel:route-reset-stats

To reset performance stats on the given route(s)

Karaf commands in Camel 2.12.4 onwards

Command

Description

camel:context-suspend

Suspends the given Camel context

camel:context-resume

Resumes the given Camel context

camel:context-list

The *camel:context-list* command displays the list of CamelContext available in the current Karaf instance:

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:route-list

The *camel:route-list* command displays the list of Camel routes available in the current Karaf instance:

You can also filter the routes by CamelContext:

Tip: use the TAB key to completion on the CamelContext ID.

camel:info-context

The *camel:context-info* command displays detail information about a given CamelContext:

add the *--verbose* option (following the context name) to also list the endpoints

You can see the current Camel version used by the CamelContext, some context attributes, the components involved in the context, and the endpoints defined.

Tip: use TAB key for completion on the CamelContext name.

camel:context-start

The *camel:context-start* command starts a given CamelContext:

Tip: use TAB key for completion on the CamelContext name.

camel:context-stop

The *camel:context-stop* command stops a given CamelContext. After stopping the context it becomes unavailable and cannot be started again.

Tip: use TAB key for completion on the CamelContext name.

camel:route-info

The *camel:route-info* command provides detail information about a Camel route:

You can see some statistics (the number of processed exchanges, the processing time, etc) and a XML rendering of your route (whatever DSL used to define the route).

Tip: use TAB key for completion on the route name.

camel:route-show

The *camel:route-show* command renders the route in XML. It's independent from the DSL used to define the route:

Tip: use TAB key for completion on the route name.

camel:route-start

The *camel:route-start* command starts a Camel route:

Tip: use TAB key for completion on the route name.

camel:route-stop

The *camel:route-stop* command stops a Camel route:

Camel 2.9 or newer:

camel:route-suspend

The *camel:route-suspend* command suspends a Camel route:

Tip: use TAB key for completion on the route name.

camel:route-resume

The *camel:route-resume* command resume a Camel route:

Tip: use TAB key for completion on the route name.

Camel 2.10 or newer:

camel:endpoint-list

The *camel:endpoint-list* command displays the list of the endpoints available in all camel contexts of the current Karaf instance:

It displays the context name/ID (used in others commands), the URI of the endpoint and the current status (started/stopped).

Camel 2.12.4 or newer:

camel:context-suspend

The *camel:context-suspend* command suspends a given CamelContext. It then may be resumed again.

Tip: use TAB key for completion on the CamelContext name.

camel:context-resume

The *camel:context-resume* command resumes a given CamelContext. After that it returns to the started state.

Tip: use TAB key for completion on the CamelContext name.

© 2004-2014 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