camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stephen samuel (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > RabbitMQ
Date Sat, 20 Jul 2013 22:58:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/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/RabbitMQ">RabbitMQ</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~samspade79@gmail.com">stephen
samuel</a>
    </h4>
        <br/>
                         <h4>Changes (6)</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" >{div:class=confluenceTableSmall} <br>||
Property || Value || <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|
{{rabbitmq.ROUTING_KEY}} |  | <br>| {{rabbitmq.EXCHANGE_NAME}} |  | <br>| {{rabbitmq.DELIVERY_TAG}}
|  | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{rabbitmq.ROUTING_KEY}} | The routing key that was used to receive the message, or the routing
key that will be used when producing a message | <br>| {{rabbitmq.EXCHANGE_NAME}} |
The exchange the message was received from | <br>| {{rabbitmq.DELIVERY_TAG}} | The rabbitmq
delivery tag of the received message | <br></td></tr>
            <tr><td class="diff-unchanged" >{div} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{div:class=confluenceTableSmall} <br>||
Property || Value || <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{rabbitmq.ROUTING_KEY}} | <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
</span> <span class="diff-added-words"style="background-color: #dfd;">The routing
key that will be used when sending the message</span> | <br></td></tr>
            <tr><td class="diff-changed-lines" >| {{rabbitmq.EXCHANGE_NAME}} |
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">
</span> <span class="diff-added-words"style="background-color: #dfd;">The exchange
the message was received from, or sent to</span> | <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|
{{rabbitmq.CONTENT_TYPE}} |  | <br>| {{rabbitmq.PRIORITY}} |  | <br>| {{rabbitmq.CORRELATIONID}}
|  | <br>| {{rabbitmq.MESSAGE_ID}} |  | <br>| {{rabbitmq.DELIVERY_MODE}} |  |
<br>| {{rabbitmq.USERID}} |  | <br>| {{rabbitmq.CLUSTERID}} |  | <br>| {{rabbitmq.REPLY_TO}}
|  | <br>| {{rabbitmq.CONTENT_ENCODING}} |  | <br>| {{rabbitmq.TYPE}} |  | <br>|
{{rabbitmq.EXPIRATION}} |  | <br>| {{rabbitmq.TIMESTAMP}} |  | <br>| {{rabbitmq.APP_ID}}
|  | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{rabbitmq.CONTENT_TYPE}} | The contentType to set on the RabbitMQ message | <br>| {{rabbitmq.PRIORITY}}
| The priority header to set on the RabbitMQ message  | <br>| {{rabbitmq.CORRELATIONID}}
| The correlationId to set on the RabbitMQ message  | <br>| {{rabbitmq.MESSAGE_ID}}
| The message id to set on the RabbitMQ message  | <br>| {{rabbitmq.DELIVERY_MODE}}
| If the message should be persistent or not | <br>| {{rabbitmq.USERID}} | The userId
to set on the RabbitMQ message  | <br>| {{rabbitmq.CLUSTERID}} | The clusterId to set
on the RabbitMQ message | <br>| {{rabbitmq.REPLY_TO}} | The replyTo to set on the RabbitMQ
message | <br>| {{rabbitmq.CONTENT_ENCODING}} | The contentEncoding to set on the RabbitMQ
message | <br>| {{rabbitmq.TYPE}} | The type to set on the RabbitMQ message| <br>|
{{rabbitmq.EXPIRATION}} | The expiration to set on the RabbitMQ message | <br>| {{rabbitmq.TIMESTAMP}}
| The timestamp to set on the RabbitMQ message | <br>| {{rabbitmq.APP_ID}} | The appId
to set on the RabbitMQ message | <br></td></tr>
            <tr><td class="diff-unchanged" >{div} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="RabbitMQ-RabbitMQComponent"></a>RabbitMQ Component</h2>

<p><b>Available as of Camel 2.12</b></p>

<p>The <b>rabbitmq:</b> component allows you produce and consume messages
from <a href="http://www.rabbitmq.com/" class="external-link" rel="nofollow">RabbitMQ</a>
instances. Using the RabbitMQ AMQP client, this component offers a pure RabbitMQ approach
over the generic <b>amqp:</b> component.</p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-rabbitmq&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="RabbitMQ-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
rabbitmq:http://hostname[:port]/exchangeName?[options...]://name[?options]
</pre>
</div></div>

<p>Where <b>hostname</b> is the hostname of the running rabbitmq instance
or cluster. Port is optional and if not specified then defaults to the RabbitMQ client default
(5672). The exchange name determines which exchange produced messages will sent to. In the
case of consumers, the exchange name determines which exchange the queue will bind to.</p>

<h3><a name="RabbitMQ-Options"></a>Options</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Property </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>autoAck</tt> </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'> If messages should be auto acknowledged </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>queue</tt> </td>
<td class='confluenceTd'> <tt>random uuid</tt> </td>
<td class='confluenceTd'> The queue to receive messages from </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>routingKey</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> The routing key to use when binding a consumer queue to the
exchange. For producer routing keys, you set the header (see header section) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>threadPoolSize</tt> </td>
<td class='confluenceTd'> <tt>10</tt> </td>
<td class='confluenceTd'> The consumer uses a Thread Pool Executor with a fixed number
of threads. This setting allows you to set that number of threads. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>username</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> username in case of authenticated access </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>password</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> password for authenticated access </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>vhost</tt> </td>
<td class='confluenceTd'> <tt>/</tt> </td>
<td class='confluenceTd'> the vhost for the channel </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="RabbitMQ-Headers"></a>Headers</h3>

<p>The following headers are set on exchanges when consuming messages.</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Property </th>
<th class='confluenceTh'> Value </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.ROUTING_KEY</tt> </td>
<td class='confluenceTd'> The routing key that was used to receive the message, or the
routing key that will be used when producing a message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.EXCHANGE_NAME</tt> </td>
<td class='confluenceTd'> The exchange the message was received from </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.DELIVERY_TAG</tt> </td>
<td class='confluenceTd'> The rabbitmq delivery tag of the received message </td>
</tr>
</tbody></table>
</div>
</div>

<p>The following headers are used by the producer. If these are set on the camel exchange
then they will be set on the RabbitMQ message.</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Property </th>
<th class='confluenceTh'> Value </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.ROUTING_KEY</tt> </td>
<td class='confluenceTd'> The routing key that will be used when sending the message
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.EXCHANGE_NAME</tt> </td>
<td class='confluenceTd'> The exchange the message was received from, or sent to </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.CONTENT_TYPE</tt> </td>
<td class='confluenceTd'> The contentType to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.PRIORITY</tt> </td>
<td class='confluenceTd'> The priority header to set on the RabbitMQ message  </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.CORRELATIONID</tt> </td>
<td class='confluenceTd'> The correlationId to set on the RabbitMQ message  </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.MESSAGE_ID</tt> </td>
<td class='confluenceTd'> The message id to set on the RabbitMQ message  </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.DELIVERY_MODE</tt> </td>
<td class='confluenceTd'> If the message should be persistent or not </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.USERID</tt> </td>
<td class='confluenceTd'> The userId to set on the RabbitMQ message  </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.CLUSTERID</tt> </td>
<td class='confluenceTd'> The clusterId to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.REPLY_TO</tt> </td>
<td class='confluenceTd'> The replyTo to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.CONTENT_ENCODING</tt> </td>
<td class='confluenceTd'> The contentEncoding to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.TYPE</tt> </td>
<td class='confluenceTd'> The type to set on the RabbitMQ message</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.EXPIRATION</tt> </td>
<td class='confluenceTd'> The expiration to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.TIMESTAMP</tt> </td>
<td class='confluenceTd'> The timestamp to set on the RabbitMQ message </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>rabbitmq.APP_ID</tt> </td>
<td class='confluenceTd'> The appId to set on the RabbitMQ message </td>
</tr>
</tbody></table>
</div>
</div>

<p>Headers are set by the consumer once the message is received. The producer will also
set the headers for downstream processors once the exchange has taken place. Any headers set
prior to production that the producer sets will be overriden.</p>

<h3><a name="RabbitMQ-MessageBody"></a>Message Body</h3>

<p>The component will use the camel exchange in body as the rabbit mq message body.
The camel exchange in object must be convertible to a byte array. Otherwise the producer will
throw an exception of unsupported body type.</p>

<h3><a name="RabbitMQ-Samples"></a>Samples</h3>

<p>To receive messages from a queue that is bound to an exchange A with the routing
key B,</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
from("rabbitmq://localhost/A?routingKey=B")
</pre>
</div></div>

<p>To receive messages from a queue with a single thread with auto acknowledge disabled.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
from("rabbitmq://localhost/A?routingKey=B&amp;threadPoolSize=1&amp;autoAck=false")
</pre>
</div></div>

<p>To send messages to an exchange called C</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
...to("rabbitmq://localhost/B")
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/RabbitMQ">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=33294950&revisedVersion=10&originalVersion=9">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/RabbitMQ?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message