Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update to supported camel versions. Delete some superficial descriptions

 

Karaf Support

Apache Camel is designed to work nicely into inside Apache Karaf OSGi container.

...

  • 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.

It is recommended to use at least Apache Karaf 4.x with current Camel versions.

 

Install Camel in Karaf

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

Code Block

karaf@root> featuresfeature:addurl mvn:org.apache.camel.karaf/apache-camel/2.8.0/xml/featuresrepo-add camel 2.18.4

Now, we have all Camel features available:

Code Block

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
...

It is a good start to at least install camel-blueprint

Code Block
karaf@root> features:install camel-blueprint

You might need other features depending on what components you use in your routes. So for example if you use stream:out then you need the camel-stream feature.

Code Block
karaf@root> features:install camel-stream

Karaf commands

The camel commands below help managing your integrations. In many cases the commands support tab completion for context and route names.

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.

camel:endpoint-list

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

camel:route-profile

To profile route(s)

camel:route-reset-stats

To reset performance stats on the given route(s)

camel:context-suspend

Suspends the given Camel context

camel:context-resume

Resumes the given Camel context

 

camel:route-list

Code Block
karaf@root> camel:route-list
[route1              ]

You can also filter the routes by CamelContext:

Code Block
karaf@root> camel:route-list 66-camel-3
[uninstalled] [2.8.0route1              ]

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

camel:context-info

Displays detailed information about a given CamelContext:

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

Code Block
karaf@root> camel:context-info 66-camel-cache 3
Camel Context 66-camel-3
        Name: 66-camel-3
         repo-0Version: 2.8.0
        Status: Started
        Uptime: 1 
[uninstalled] [2.8.0  minute

Advanced
        Auto Startup: true
        ] camel-castor Starting Routes: false
        Suspended: false
        repo-0 Tracing: false

Properties

Components
        timer
        properties
[uninstalled] [2.8.0       log

Endpoints
   ] camel-crypto    timer://test
        log://test

Routes
      repo-0  route1

Used Languages

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

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

Code Block
karaf@root> camel:route-info route1
Camel Route route1
        Camel Context: 
[uninstalled] [2.8.066-camel-3

Properties
             ] camel-http  id = route1
                repo-0parent = 2e7aacc1

Statistics
        Exchanges Total: 98
     
[uninstalled] [2.8.0  Exchanges Completed: 98
      ] camel-http4 Exchanges Failed: 0
        Min Processing Time: 1ms
     repo-0   Max Processing Time: 2ms
        Mean Processing Time: 1ms
[uninstalled] [2.8.0        Total Processing Time: 134ms
 ] camel-mina      Last Processing Time: 1ms
        First Exchange Date: repo2011-06-0 29 07:21:57
        Last Exchange Completed Date: 2011-06-29 07:23:34

Definition
<?xml version="1.0" encoding="UTF-8" 
[uninstalled] [2.8.0    standalone="yes"?>
<route id="route1" xmlns="http://camel.apache.org/schema/spring">
    <from uri="timer:test"/>
    <to uri="log:test" id="to1"/>
</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:

Code Block
karaf@root> camel:route-show route1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="route1" xmlns="http://camel.apache.org/schema/spring">
    <from uri="timer:test"/>
    <to uri="log:test" id="to1"/>
</route>

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

camel:route-suspend

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

Code Block
karaf@root> camel:route-suspend route1

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

camel:route-resume

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

Code Block
karaf@root> camel:route-resume route1

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

camel:endpoint-list

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

Code Block
karaf@root> camel:endpoint-list 
camel-id ] camel-jetty                   repo-0                 
[uninstalled] [2.8.0uri           ] camel-servlet      Status           repo-0   
[test              
[uninstalled] [2.8.0timer://test      ] [Started     ] camel-jms     ]
[test              ]  repo-0[direct://A        ] [Started         
...

To install Camel, just install the camel feature:

Code Block

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:

Code Block

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:

Code Block

karaf@root> features:install camel-stream
]

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

 

...