camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Creating a new Camel Component
Date Tue, 25 Oct 2011 09:27: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/Creating+a+new+Camel+Component">Creating
a new Camel Component</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h2.
<br> <br> <br>h2. <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Creating a new Camel Component
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >If you want to create your own
version of the <span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">[</span>Camel
<span class="diff-added-chars"style="background-color: #dfd;">[</span>Component]</span>
you can use the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">maven
archetype.</span> <span class="diff-added-words"style="background-color: #dfd;">[Camel
Maven Archetypes].</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  -DarchetypeGroupId=org.apache.camel.archetypes
 \ <br>  -DarchetypeArtifactId=camel-archetype-component \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">-DarchetypeVersion=2.<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">2</span><span
class="diff-added-chars"style="background-color: #dfd;">9</span>.0</span> 
\ <br></td></tr>
            <tr><td class="diff-unchanged" >  -DgroupId=myGroupId            
     \ <br>  -DartifactId=myArtifactId <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  -DarchetypeGroupId=org.apache.camel.archetypes
 \ <br>  -DarchetypeArtifactId=camel-archetype-component \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">-DarchetypeVersion=2.<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">2</span><span
class="diff-added-chars"style="background-color: #dfd;">9</span>.0</span> 
\ <br></td></tr>
            <tr><td class="diff-unchanged" >  -DgroupId=myGroupId            
     \ <br>  -DartifactId=myArtifactId  \ <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="CreatinganewCamelComponent-CreatinganewCamelComponent"></a>Creating
a new Camel Component</h2>

<p>If you want to create your own version of the Camel <a href="/confluence/display/CAMEL/Component"
title="Component">Component</a> you can use the <a href="/confluence/display/CAMEL/Camel+Maven+Archetypes"
title="Camel Maven Archetypes">Camel Maven Archetypes</a>.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn archetype:generate                   \
  -DarchetypeGroupId=org.apache.camel.archetypes  \
  -DarchetypeArtifactId=camel-archetype-component \
  -DarchetypeVersion=2.9.0  \
  -DgroupId=myGroupId                  \
  -DartifactId=myArtifactId
</pre>
</div></div>

<p>This will create a maven project which contains a demo component, you need to implements
your own component by modifying it.You need to move the META-INF/services/direct file to META-INF/services/PACKAGE_NAME/FOO
where FOO is the URI scheme for your component and any related endpoints created on the fly
and PACKAGE_NAME is your component's package name which is replaced the '.' with '/'.</p>

<h4><a name="CreatinganewCamelComponent-Optionalproperties%28availableasofCamel2.9.0%29"></a>Optional
properties (available as of Camel 2.9.0)</h4>

<p>By default the camel component archetype will generate a HelloWorldComponent that
will use the URI scheme helloworld. You can further customize the generated component by using
some custom parameters passed to the component.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> name </td>
<td class='confluenceTd'> HelloWorld </td>
<td class='confluenceTd'> The name of the component. It will be used as a prefix for
all generated classes. </td>
</tr>
<tr>
<td class='confluenceTd'> scheme </td>
<td class='confluenceTd'> helloworld </td>
<td class='confluenceTd'> The default URI scheme the component will use. </td>
</tr>
</tbody></table>
</div>


<h4><a name="CreatinganewCamelComponent-UsageExamples%3A"></a>Usage Examples:</h4>

<p>To create the "Awesome" component and all its related classes (AwesomeComponent,
AwesomeEndpoint, AwesomeProducer etc) that will use the awesome URI scheme: </p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn archetype:generate                   \
  -DarchetypeGroupId=org.apache.camel.archetypes  \
  -DarchetypeArtifactId=camel-archetype-component \
  -DarchetypeVersion=2.9.0  \
  -DgroupId=myGroupId                  \
  -DartifactId=myArtifactId  \
  -Dname=Awesome             \
  -Dscheme=awsome            \
  
</pre>
</div></div>

<p>For more help see <a href="/confluence/display/CAMEL/Writing+Components" title="Writing
Components">Writing Components</a></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/Creating+a+new+Camel+Component">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=79286&revisedVersion=7&originalVersion=6">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Creating+a+new+Camel+Component?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message