camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > AWS-SNS
Date Wed, 20 Mar 2013 17: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/AWS-SNS">AWS-SNS</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" >{div} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >h4. Advanced <span class="diff-changed-words">AmazonSNS<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">Client</span></span>
configuration <br></td></tr>
            <tr><td class="diff-unchanged" >If you need more control over the
{{AmazonSNS}} instance configuration you can create your own instance and refer to it from
the URI: <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="AWS-SNS-SNSComponent"></a>SNS Component</h2>
<p><b>Available as of Camel 2.8</b></p>

<p>The SNS component allows messages to be sent to an <a href="http://aws.amazon.com/sns"
class="external-link" rel="nofollow">Amazon Simple Notification</a> Topic. The implementation
of the Amazon API is provided by the&nbsp;<a href="http://aws.amazon.com/sdkforjava/"
class="external-link" rel="nofollow">AWS SDK</a>.</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 SNS. More information are available at <a href="http://aws.amazon.com/sns" class="external-link"
rel="nofollow">Amazon SNS</a>.</td></tr></table></div>

<h3><a name="AWS-SNS-URIFormat"></a>URI Format</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
aws-sns:<span class="code-comment">//topicName[?options]</span>
</pre>
</div></div>
<p>The topic will be created if they don't already exists.<br/>
You can append query options to the URI in the following format, <tt>?options=value&amp;option2=value&amp;...</tt></p>

<h3><a name="AWS-SNS-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'>amazonSNSClient </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> Reference to a <tt>com.amazonaws.services.sns.AmazonSNS</tt>
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'> Producer </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'> Producer </td>
<td class='confluenceTd'> Amazon AWS Secret Key </td>
</tr>
<tr>
<td class='confluenceTd'>subject </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> The subject which is used if the message header 'CamelAwsSnsSubject'
is not present. </td>
</tr>
<tr>
<td class='confluenceTd'>amazonSNSEndpoint </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> The region with which the AWS-SNS client wants to work with.
</td>
</tr>
<tr>
<td class='confluenceTd'>policy </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> <b>Camel 2.8.4</b>: The policy for this queue
to set in the <tt>com.amazonaws.services.sns.model.SetTopicAttributesRequest</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
SNS component options</b><br />You have to provide the amazonSNSClient 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/sns" class="external-link"
rel="nofollow">Amazon's SNS</a>.</td></tr></table></div>

<h3><a name="AWS-SNS-Usage"></a>Usage</h3>
<h4><a name="AWS-SNS-MessageheadersevaluatedbytheSNSproducer"></a>Message
headers evaluated by the SNS 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>CamelAwsSnsSubject</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The Amazon SNS message subject. If not set, the subject from
the <tt>SnsConfiguration</tt> is used. </td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="AWS-SNS-MessageheaderssetbytheSNSproducer"></a>Message headers
set by the SNS 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>CamelAwsSnsMessageId</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The Amazon SNS message ID. </td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="AWS-SNS-AdvancedAmazonSNSconfiguration"></a>Advanced AmazonSNS
configuration</h4>
<p>If you need more control over the <tt>AmazonSNS</tt> instance configuration
you can create your own instance and refer to it from the URI:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
.to(<span class="code-quote">"aws-sns:<span class="code-comment">//MyTopic?amazonSNSClient=#client"</span>);</span>
</pre>
</div></div>
<p>The <tt>#client</tt> refers to a <tt>AmazonSNS</tt> in the
<a href="/confluence/display/CAMEL/Registry" title="Registry">Registry</a>.</p>

<p>For example if your Camel Application is running behind a firewall:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
AWSCredentials awsCredentials = <span class="code-keyword">new</span> BasicAWSCredentials(<span
class="code-quote">"myAccessKey"</span>, <span class="code-quote">"mySecretKey"</span>);
ClientConfiguration clientConfiguration = <span class="code-keyword">new</span>
ClientConfiguration();
clientConfiguration.setProxyHost(<span class="code-quote">"http:<span class="code-comment">//myProxyHost"</span>);
</span>clientConfiguration.setProxyPort(8080);
AmazonSNS client = <span class="code-keyword">new</span> AmazonSNSClient(awsCredentials,
clientConfiguration);

registry.bind(<span class="code-quote">"client"</span>, client);
</pre>
</div></div>

<h3><a name="AWS-SNS-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.8 or higher).</p>

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

Mime
View raw message