camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > sqs
Date Thu, 13 Jan 2011 05:49:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/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/sqs">sqs</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (7)</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" >h3. URI Format <br>{code} <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">aw</span>s<span class="diff-added-chars"style="background-color:
#dfd;">-s</span>qs://queue-name</span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >This component implements the [Batch
Consumer].  <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >h4. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Exchange
Properties,</span> <span class="diff-added-words"style="background-color: #dfd;">Message
headers,</span> sqs consumer and producer <br></td></tr>
            <tr><td class="diff-unchanged" >{div:class=confluenceTableSmall} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">||
Property || Description || <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">||
Header || Type || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" >| <span class="diff-changed-words">{{Camel<span
class="diff-added-chars"style="background-color: #dfd;">Aws</span>SqsMD5OfBody}}</span>
| <span class="diff-added-words"style="background-color: #dfd;">{{String}} |</span>
The MD5 checksum of the Amazon SQS message. | <br></td></tr>
            <tr><td class="diff-changed-lines" >| <span class="diff-changed-words">{{Camel<span
class="diff-added-chars"style="background-color: #dfd;">Aws</span>SqsMessageId}}</span>
| <span class="diff-added-words"style="background-color: #dfd;">{{String}} |</span>
The Amazon SQS message ID. | <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{CamelAwsSqsReceiptHandle}} | {{String}} |  The Amazon SQS message receipt handle. | <br>|
{{CamelAwsSqsAttributes}} | {{Map&lt;String, String&gt;}} | The Amazon SQS message
attributes. | <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="sqs-SQSComponent"></a>SQS Component</h2>
<p><b>Available as of Camel 2.6</b></p>

<p>The sqs component supports sending and receiving messages to <a href="http://aws.amazon.com/sqs"
class="external-link" rel="nofollow">Amazon's SQS</a> service.</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>Prerequisites</b><br
/>You must have a valid Amazon Web Services developer account, and be signed up to use
Amazon SQS. More information are available at <a href="http://aws.amazon.com/sqs" class="external-link"
rel="nofollow">Amazon SQS</a>.</td></tr></table></div>

<h3><a name="sqs-URIFormat"></a>URI Format</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
aws-sqs:<span class="code-comment">//queue-name</span>
</pre>
</div></div>

<h3><a name="sqs-URIOptions"></a>URI Options</h3>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Context </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'>amazonSQSClient </td>
<td class='confluenceTd'> null </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> Reference to a com.amazonaws.services.sqs.AmazonSQSClient
in the <a href="/confluence/display/CAMEL/Registry" title="Registry">Registry</a>.
</td>
</tr>
<tr>
<td class='confluenceTd'>accessKey </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> Amazon AWS Access Key </td>
</tr>
<tr>
<td class='confluenceTd'>secretKey </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> Amazon AWS Secret Key </td>
</tr>
<tr>
<td class='confluenceTd'>attributeNames </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> A list of attributes to set in the <tt>com.amazonaws.services.sqs.model.ReceiveMessageRequest</tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'>defaultVisibilityTimeout </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> The visibility timeout (in seconds) to set in the <tt>com.amazonaws.services.sqs.model.CreateQueueRequest</tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'>deleteAfterRead </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> Delete message from SQS after it has been read </td>
</tr>
<tr>
<td class='confluenceTd'>maxMessagesPerPoll</td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> The maximum number of messages which can be received in one
poll to set in the <tt>com.amazonaws.services.sqs.model.ReceiveMessageRequest</tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'>visibilityTimeout </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> The duration (in seconds) that the received messages are hidden
from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set
in the <tt>com.amazonaws.services.sqs.model.ReceiveMessageRequest</tt>. </td>
</tr>
</tbody></table>
</div>


<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>Required
SQS component options</b><br />You have to provide the amazonSQSClient in the
<a href="/confluence/display/CAMEL/Registry" title="Registry">Registry</a> or
your accessKey and secretKey to access the <a href="http://aws.amazon.com/sqs" class="external-link"
rel="nofollow">Amazon's SQS</a>.</td></tr></table></div>

<h3><a name="sqs-Usage"></a>Usage</h3>

<h3><a name="sqs-BatchConsumer"></a>Batch Consumer</h3>
<p>This component implements the <a href="/confluence/display/CAMEL/Batch+Consumer"
title="Batch Consumer">Batch Consumer</a>. </p>

<h4><a name="sqs-Messageheaders%2Csqsconsumerandproducer"></a>Message headers,
sqs consumer and producer</h4>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Header </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsSqsMD5OfBody</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The MD5 checksum of the Amazon SQS message. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsSqsMessageId</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The Amazon SQS message ID. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsSqsReceiptHandle</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'>  The Amazon SQS message receipt handle. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsSqsAttributes</tt> </td>
<td class='confluenceTd'> <tt>Map&lt;String, String&gt;</tt> </td>
<td class='confluenceTd'> The Amazon SQS message attributes. </td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="sqs-ExchangeProperties%2Csqsconsumeronly"></a>Exchange Properties,
sqs consumer only</h4>
<p>As the sqs consumer is <tt>BatchConsumer</tt> it supports batching the
messages it polls. By batching it means that Camel will add some properties to the <a href="/confluence/display/CAMEL/Exchange"
title="Exchange">Exchange</a> so you know the number of messages polled the current
index in that order.</p>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Property </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelBatchSize</tt> </td>
<td class='confluenceTd'> The total number of messages that was polled in this batch.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelBatchIndex</tt> </td>
<td class='confluenceTd'> The current index of the batch. Starts from 0. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelBatchComplete</tt> </td>
<td class='confluenceTd'> A <tt>boolean</tt> value indicating the last <a
href="/confluence/display/CAMEL/Exchange" title="Exchange">Exchange</a> in the batch.
Is only <tt>true</tt> for the last entry. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelSqsAttributes</tt> </td>
<td class='confluenceTd'> The returned attribute <tt>java.util.Map</tt>.
 </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelSqsReceiptHandle</tt> </td>
<td class='confluenceTd'> A reference to so that method calls can be chained together
(e.g. the delete request after the message is consumed). </td>
</tr>
</tbody></table>
</div>
</div>

<p>This allows you for instance to know how many messages exists in this batch and for
instance let the <a href="/confluence/display/CAMEL/Aggregator" title="Aggregator">Aggregator</a>
aggregate this number of messages.</p>


<h3><a name="sqs-Dependencies"></a>Dependencies</h3>
<p>Maven users will need to add the following dependency to their pom.xml.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>pom.xml</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-aws<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>${camel-version}<span
class="code-tag">&lt;/version&gt;</span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>

<p>where <tt>${camel-version</tt>} must be replaced by the actual version
of Camel (2.6 or higher).</p>

<h3><a name="sqs-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

<ul class="alternate" type="square">
	<li><a href="/confluence/display/CAMEL/aws" title="aws">AWS Component</a></li>
</ul>

    </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/sqs">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=24192357&revisedVersion=9&originalVersion=8">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/sqs?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message