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-S3
Date Mon, 03 Dec 2012 10:40: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-S3">AWS-S3</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~massyl">Massil
Nait</a>
    </h4>
        <br/>
                         <h4>Changes (2)</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" >| {{CamelAwsS3LastModified}} | {{java.util.Date}}
| *Camel 2.8.2:* The last modified timestamp of this object. | <br>| {{CamelAwsS3StorageClass}}
| {{String}} | *Camel 2.8.4:* The storage class of this object. | <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|
{{CamelAwsS3CannedAcl}}  | {{String}} | The canned acl that will be used to the object  <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">|
{{CamelAwsS3CannedAcl}}  | {{String}} | The canned acl that will be applied to the object.
see {{com.amazonaws.services.s3.model.CannedAccessControlList}} <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="AWS-S3-S3Component"></a>S3 Component</h2>
<p><b>Available as of Camel 2.8</b></p>

<p>The S3 component supports storing and retrieving objetcs from/to <a href="http://aws.amazon.com/s3"
class="external-link" rel="nofollow">Amazon's S3</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 S3. More information are available at <a href="http://aws.amazon.com/s3" class="external-link"
rel="nofollow">Amazon S3</a>.</td></tr></table></div>

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

<h3><a name="AWS-S3-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'>amazonS3Client </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> Reference to a <tt>com.amazonaws.services.sqs.AmazonS3Client</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'> 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'>amazonS3Endpoint </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> The region with which the AWS-S3 client wants to work with.
</td>
</tr>
<tr>
<td class='confluenceTd'>region </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> The region who the bucket is located. This option is used
in the <tt>com.amazonaws.services.s3.model.CreateBucketRequest</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 objects from S3 after it has been retrieved. </td>
</tr>
<tr>
<td class='confluenceTd'>maxMessagesPerPoll</td>
<td class='confluenceTd'> 10 </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> The maximum number of objects which can be retrieved in one
poll. Used in in the <tt>com.amazonaws.services.s3.model.ListObjectsRequest</tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'>policy</td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Shared </td>
<td class='confluenceTd'> <b>Camel 2.8.4</b>: The policy for this queue
to set in the <tt>com.amazonaws.services.s3.AmazonS3#setBucketPolicy()</tt> method.
</td>
</tr>
<tr>
<td class='confluenceTd'>storageClass</td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Producer </td>
<td class='confluenceTd'> <b>Camel 2.8.4</b>: The storage class to set in
the <tt>com.amazonaws.services.s3.model.PutObjectRequest</tt> request. </td>
</tr>
<tr>
<td class='confluenceTd'>prefix </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Consumer </td>
<td class='confluenceTd'> <b>Camel 2.10.1</b>: The prefix which is used
in the <tt>com.amazonaws.services.s3.model.ListObjectsRequest</tt> to only consume
objects we are interested in. </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
S3 component options</b><br />You have to provide the amazonS3Client 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/s3" class="external-link" rel="nofollow">Amazon's
S3</a>.</td></tr></table></div>

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

<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="AWS-S3-Usage"></a>Usage</h3>
<h4><a name="AWS-S3-MessageheadersevaluatedbytheS3producer"></a>Message
headers evaluated by the S3 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>CamelAwsS3Key</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The key under which this object will be stored. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentLength</tt> </td>
<td class='confluenceTd'> <tt>Long</tt> </td>
<td class='confluenceTd'> The content length of this object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentType</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The content type of this object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentControl</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.2:</b> The content control of this
object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentDisposition</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.2:</b> The content disposition of
this object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentEncoding</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.2:</b> The content encoding of this
object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentMD5</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.2:</b> The md5 checksum of this object.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3LastModified</tt> </td>
<td class='confluenceTd'> <tt>java.util.Date</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.2:</b> The last modified timestamp
of this object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3StorageClass</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <b>Camel 2.8.4:</b> The storage class of this
object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3CannedAcl</tt>  </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The canned acl that will be applied to the object. see <tt>com.amazonaws.services.s3.model.CannedAccessControlList</tt></td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="AWS-S3-MessageheaderssetbytheS3producer"></a>Message headers
set by the S3 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>CamelAwsS3ETag</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The ETag value for the newly uploaded object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3VersionId</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The <b>optional</b> version ID of the newly uploaded
object. </td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="AWS-S3-MessageheaderssetbytheS3consumer"></a>Message headers
set by the S3 consumer</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>CamelAwsS3Key</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The key under which this object is stored. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3BucketName</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The name of the bucket in which this object is contained.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ETag</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The hex encoded 128-bit MD5 digest of the associated object
according to RFC 1864. This data is used as an integrity check to verify that the data received
by the caller is the same data that was sent by Amazon S3. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3LastModified</tt> </td>
<td class='confluenceTd'> <tt>Date</tt> </td>
<td class='confluenceTd'> The value of the Last-Modified header, indicating the date
and time at which Amazon S3 last recorded a modification to the associated object. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3VersionId</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The version ID of the associated Amazon S3 object if available.
Version IDs are only assigned to objects when an object is uploaded to an Amazon S3 bucket
that has object versioning enabled. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentType</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The Content-Type HTTP header, which indicates the type of
content stored in the associated object. The value of this header is a standard MIME type.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentMD5</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The base64 encoded 128-bit MD5 digest of the associated object
(content - not including headers) according to RFC 1864. This data is used as a message integrity
check to verify that the data received by Amazon S3 is the same data that the caller sent.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentLength</tt> </td>
<td class='confluenceTd'> <tt>Long</tt> </td>
<td class='confluenceTd'> The Content-Length HTTP header indicating the size of the
associated object in bytes. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentEncoding</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The <b>optional</b> Content-Encoding HTTP header
specifying what content encodings have been applied to the object and what decoding mechanisms
must be applied in order to obtain the media-type referenced by the Content-Type field. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentDisposition</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The <b>optional</b> Content-Disposition HTTP header,
which specifies presentational information such as the recommended filename for the object
to be saved as. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CamelAwsS3ContentControl</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> The <b>optional</b> Cache-Control HTTP header
which allows the user to specify caching behavior along the HTTP request/reply chain. </td>
</tr>
</tbody></table>
</div>
</div>

<h4><a name="AWS-S3-AdvancedAmazonS3Clientconfiguration"></a>Advanced AmazonS3Client
configuration</h4>
<p>If your Camel Application is running behind a firewall or if you need to have more
control over the AmazonS3Client configuration, you can create your own instance:</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);

AmazonS3Client client = <span class="code-keyword">new</span> AmazonS3Client(awsCredentials,
clientConfiguration);
</pre>
</div></div>

<p>and refer to it in your Camel aws-s3 component configuration:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"aws-s3:<span class="code-comment">//MyBucket?amazonS3Client=#amazonS3Client&amp;delay=5000&amp;maxMessagesPerPoll=5"</span>)
</span>.to(<span class="code-quote">"mock:result"</span>);
</pre>
</div></div>

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

Mime
View raw message