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 Thu, 07 Jul 2011 20:16: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/~nanthrax">Jean-Baptiste
Onofré</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" >  *NB: Karaf commands are available
starting with Camel 2.8.0*. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h2.
Preparing Karaf for Camel <br> <br>Camel uses several bundles to provide low level
package, such as javax.annotation or javax.xml.bind. <br> <br>Due to that, we
mustn&#39;t use the default system package coming from the JDK. It means that we need
to &quot;exclude&quot; some packages from system packages in order to use packages
provided by tiers bundles. <br> <br>Camel provides a ready to use config.properties
file that you can download: <br> <br>http://svn.apache.org/repos/asf/camel/tags/camel-2.7.2/platforms/karaf/features/src/main/resources/config.properties
<br> <br>This file has to be copied into Karaf etc folder. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Install Camel in Karaf <br>
<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>.</li>
</ul>


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

<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.0/xml/features
</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-camel%3Alistcontexts"></a>camel:list-contexts</h3>

<p>The *<b>camel:list-contexts</b>* 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>* 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>* 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>* 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>* 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>* 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>* 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>* 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>* 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>

<p><em>Tip: use TAB key for completion on the route name.</em></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=5&originalVersion=4">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