camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Karaf
Date Wed, 27 Jun 2012 20:43:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Karaf">Karaf</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~muellerc">Christian
Mueller</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >| 2.8.2 | 2.2.4 | <br>| 2.9.0
| 2.2.5 | <br></td></tr>
            <tr><td class="diff-changed-lines" >| 2.10.0 | <span class="diff-changed-words">2.2.<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">7</span><span
class="diff-added-chars"style="background-color: #dfd;">8</span></span> | <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Preparing Karaf for
Camel <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Karaf-KarafSupport"></a>Karaf Support</h2>

<p>Apache Camel is designed to work nicely into <a href="http://karaf.apache.org"
class="external-link" rel="nofollow">Apache Karaf</a> OSGi container.</p>

<p>It includes:</p>
<ul>
	<li>Camel features descriptor allowing to easily and quickly install Camel in Karaf.</li>
	<li>Karaf commands allowing you to view, start, stop, get info, about the Camel contexts
and routes running in the Karaf instance.<br/>
<b>NB: Karaf commands are available starting with Camel 2.8.0</b>, and the commands
was renamed in Camel 2.9.0.</li>
</ul>


<p>Here are the versions that are compatible. </p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Camel Version </th>
<th class='confluenceTh'> Karaf Version </th>
</tr>
<tr>
<td class='confluenceTd'> 2.2.0 </td>
<td class='confluenceTd'> 1.2.0 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.3.0 </td>
<td class='confluenceTd'> 1.3.0 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.4.0 </td>
<td class='confluenceTd'> 1.4.0 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.5.0 </td>
<td class='confluenceTd'> 2.1.0 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.7.0 </td>
<td class='confluenceTd'> 2.2.0 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.7.2 </td>
<td class='confluenceTd'> 2.2.2 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.8.2 </td>
<td class='confluenceTd'> 2.2.4 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.9.0 </td>
<td class='confluenceTd'> 2.2.5 </td>
</tr>
<tr>
<td class='confluenceTd'> 2.10.0 </td>
<td class='confluenceTd'> 2.2.8 </td>
</tr>
</tbody></table>
</div>


<h2><a name="Karaf-PreparingKarafforCamel"></a>Preparing Karaf for Camel</h2>

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

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

<p>Camel provides a ready to use config.properties file that you can download:</p>

<p><a href="http://svn.apache.org/repos/asf/camel/tags/camel-2.7.2/platforms/karaf/features/src/main/resources/config.properties"
class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/camel/tags/camel-2.7.2/platforms/karaf/features/src/main/resources/config.properties</a></p>

<p>This file has to be copied into Karaf etc folder.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Karaf 2.2.5
or newer</b><br />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.</td></tr></table></div>

<h2><a name="Karaf-InstallCamelinKaraf"></a>Install Camel in Karaf</h2>

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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:addurl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/features
</pre>
</div></div>

<p>From Karaf 2.2.6 onwards this has been simplified as there is a new <tt>features:chooseurl</tt>
command that is pre-setup for Camel</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:chooseurl camel 2.9.1
</pre>
</div></div>


<p>Now, we have all Camel features available:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; 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
...
</pre>
</div></div>

<p>To install Camel, just install the camel feature:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:install camel
</pre>
</div></div>

<p>You have to install the Camel features depending of your requirements.</p>

<p>For instance, if you want to use blueprint as Camel DSL, you have to install the
camel-blueprint feature:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:install camel-blueprint
</pre>
</div></div>

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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:install camel-stream
</pre>
</div></div>

<h2><a name="Karaf-Karafcommands"></a>Karaf commands</h2>

<p>When you install the camel feature, new Karaf commands become available automatically.</p>

<h3><a name="Karaf-KarafcommandsinCamel2.8.x"></a>Karaf commands in Camel
2.8.x</h3>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Command </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:list-contexts</b> </td>
<td class='confluenceTd'> Lists the camel contexts available in the current Karaf instance
</td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:list-routes</b> </td>
<td class='confluenceTd'> Displays the list of Camel routes available in the current
Karaf instance </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:info-context</b> </td>
<td class='confluenceTd'> Displays detail information about a given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:start-context</b> </td>
<td class='confluenceTd'> Starts the given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:stop-context</b> </td>
<td class='confluenceTd'> Stops the given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:info-route</b> </td>
<td class='confluenceTd'> Provides detail information about a Camel route </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:show-route</b> </td>
<td class='confluenceTd'> Renders the route in XML </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:start-route</b> </td>
<td class='confluenceTd'> Starts the given route. </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:stop-route</b> </td>
<td class='confluenceTd'> Stops the given route. </td>
</tr>
</tbody></table>
</div>


<h3><a name="Karaf-KarafcommandsinCamel2.9onwards"></a>Karaf commands in
Camel 2.9 onwards</h3>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Command </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:context-list</b> </td>
<td class='confluenceTd'> Lists the camel contexts available in the current Karaf instance
</td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:context-info</b> </td>
<td class='confluenceTd'> Displays detail information about a given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:context-start</b> </td>
<td class='confluenceTd'> Starts the given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:context-stop</b> </td>
<td class='confluenceTd'> Stops the given Camel context </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-list</b> </td>
<td class='confluenceTd'> Displays the list of Camel routes available in the current
Karaf instance </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-info</b> </td>
<td class='confluenceTd'> Provides detail information about a Camel route </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-show</b> </td>
<td class='confluenceTd'> Renders the route in XML </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-start</b> </td>
<td class='confluenceTd'> Starts the given route. From Camel <b>2.10</b>
onwards you can use * as wildcard to match multiple routes. </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-stop</b> </td>
<td class='confluenceTd'> Stops the given route. From Camel <b>2.10</b>
onwards you can use * as wildcard to match multiple routes. </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-suspend</b> </td>
<td class='confluenceTd'> Suspends the given route. From Camel <b>2.10</b>
onwards you can use * as wildcard to match multiple routes. </td>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:route-resume</b> </td>
<td class='confluenceTd'> Resumes the given route. From Camel <b>2.10</b>
onwards you can use * as wildcard to match multiple routes. </td>
</tr>
</tbody></table>
</div>


<h3><a name="Karaf-KarafcommandsinCamel2.10onwards"></a>Karaf commands in
Camel 2.10 onwards</h3>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Command </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <b>camel:endpoint-list</b> </td>
<td class='confluenceTd'> Lists endpoints fromm all camel contexts available in the
current Karaf instance </td>
</tr>
</tbody></table>
</div>




<h3><a name="Karaf-camel%3Alistcontexts"></a>camel:list-contexts</h3>

<p>The *<b>camel:list-contexts</b>&#42; command displays the list of
CamelContext available in the current Karaf instance:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:list-contexts
Name                 Status               Uptime
[66-camel-3        ] [Started           ] [14.559 seconds    ]
</pre>
</div></div>

<p>It displays the context name/ID (used in others commands), the current status (started/stopped),
the uptime (since when the context has been started).</p>

<h3><a name="Karaf-camel%3Alistroutes"></a>camel:list-routes</h3>

<p>The *<b>camel:list-routes</b>&#42; command displays the list of Camel
routes available in the current Karaf instance:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:list-routes
[route1              ]
</pre>
</div></div>

<p>You can also filter the routes by CamelContext:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:list-routes 66-camel-3
[route1              ]
</pre>
</div></div>

<p><em>Tip: use the TAB key to completion on the CamelContext ID.</em></p>

<h3><a name="Karaf-camel%3Ainfocontext"></a>camel:info-context</h3>

<p>The *<b>camel:info-context</b>&#42; command displays detail information
about a given CamelContext:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:info-context 66-camel-3
Camel Context 66-camel-3
        Name: 66-camel-3
        Version: 2.8.0
        Status: Started
        Uptime: 1 minute

Advanced
        Auto Startup: <span class="code-keyword">true</span>
        Starting Routes: <span class="code-keyword">false</span>
        Suspended: <span class="code-keyword">false</span>
        Tracing: <span class="code-keyword">false</span>

Properties

Components
        timer
        properties
        log

Endpoints
        timer:<span class="code-comment">//test
</span>        log:<span class="code-comment">//test
</span>
Routes
        route1

Used Languages

</pre>
</div></div>

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

<p><em>Tip: use TAB key for completion on the CamelContext name.</em></p>

<h3><a name="Karaf-camel%3Astartcontext"></a>camel:start-context</h3>

<p>The *<b>camel:start-context</b>&#42; command starts a given CamelContext:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:start-context 66-camel-3
</pre>
</div></div>

<p><em>Tip: use TAB key for completion on the CamelContext name.</em></p>

<h3><a name="Karaf-camel%3Astopcontext"></a>camel:stop-context</h3>

<p>The *<b>camel:stop-context</b>&#42; command stops a given CamelContext:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; karaf@root&gt; camel:stop-context 66-camel-3
</pre>
</div></div>

<p><em>Tip: use TAB key for completion on the CamelContext name.</em></p>

<h3><a name="Karaf-camel%3Ainforoute"></a>camel:info-route</h3>

<p>The *<b>camel:info-route</b>&#42; command provides detail information
about a Camel route:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:info-route route1
Camel Route route1
        Camel Context: 66-camel-3

Properties
                id = route1
                parent = 2e7aacc1

Statistics
        Exchanges Total: 98
        Exchanges Completed: 98
        Exchanges Failed: 0
        Min Processing Time: 1ms
        Max Processing Time: 2ms
        Mean Processing Time: 1ms
        Total Processing Time: 134ms
        Last Processing Time: 1ms
        First Exchange Date: 2011-06-29 07:21:57
        Last Exchange Completed Date: 2011-06-29 07:23:34

Definition
&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>
standalone=<span class="code-quote">"yes"</span>?&gt;
&lt;route id=<span class="code-quote">"route1"</span> xmlns=<span class="code-quote">"http:<span
class="code-comment">//camel.apache.org/schema/spring"</span>&gt;
</span>    &lt;from uri=<span class="code-quote">"timer:test"</span>/&gt;
    &lt;to uri=<span class="code-quote">"log:test"</span> id=<span class="code-quote">"to1"</span>/&gt;
&lt;/route&gt;
</pre>
</div></div>

<p>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).</p>

<p><em>Tip: use TAB key for completion on the route name.</em></p>

<h3><a name="Karaf-camel%3Ashowroute"></a>camel:show-route</h3>

<p>The *<b>camel:show-route</b>&#42; command renders the route in XML.
It's independent from the DSL used to define the route:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:show-route route1
&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>
standalone=<span class="code-quote">"yes"</span>?&gt;
&lt;route id=<span class="code-quote">"route1"</span> xmlns=<span class="code-quote">"http:<span
class="code-comment">//camel.apache.org/schema/spring"</span>&gt;
</span>    &lt;from uri=<span class="code-quote">"timer:test"</span>/&gt;
    &lt;to uri=<span class="code-quote">"log:test"</span> id=<span class="code-quote">"to1"</span>/&gt;
&lt;/route&gt;
</pre>
</div></div>

<p><em>Tip: use TAB key for completion on the route name.</em></p>

<h3><a name="Karaf-camel%3Astartroute"></a>camel:start-route</h3>

<p>The *<b>camel:start-route</b>&#42; command starts a Camel route:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:start-route route1
</pre>
</div></div>

<p><em>Tip: use TAB key for completion on the route name.</em></p>

<h3><a name="Karaf-camel%3Astoproute"></a>camel:stop-route</h3>

<p>The *<b>camel:stop-route</b>&#42; command stops a Camel route:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:stop-route route1
</pre>
</div></div>

<h4><a name="Karaf-Camel2.9ornewer%3A"></a>Camel 2.9 or newer:</h4>

<h3><a name="Karaf-camel%3Aroutesuspend"></a>camel:route-suspend</h3>

<p>The *<b>camel:start-route</b>&#42; command suspends a Camel route:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:route-suspend route1
</pre>
</div></div>
<p><em>Tip: use TAB key for completion on the route name.</em></p>

<h3><a name="Karaf-camel%3Aresumeroute"></a>camel:resume-route</h3>

<p>The *<b>camel:route-resume</b>&#42; command resume a Camel route:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:route-resume route1
</pre>
</div></div>
<p><em>Tip: use TAB key for completion on the route name.</em></p>

<h4><a name="Karaf-Camel2.10ornewer%3A"></a>Camel 2.10 or newer:</h4>

<h3><a name="Karaf-camel%3Aendpointlist"></a>camel:endpoint-list</h3>

<p>The *<b>camel:endpoint-list</b>&#42; command displays the list of
the endpoints available in all camel contexts of the current Karaf instance:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; camel:endpoint-list 
camel-id             uri                  Status              
[test              ] [timer:<span class="code-comment">//test      ] [Started      
    ]
</span>[test              ] [direct:<span class="code-comment">//A        ] [Started
          ]</span>
</pre>
</div></div>

<p>It displays the context name/ID (used in others commands), the URI of the endpoint
and the current status (started/stopped).</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Karaf">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27820272&revisedVersion=16&originalVersion=15">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Karaf?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message