cAWSS3
(S3)
cAWSS3 Standard properties
These properties are used to configure cAWSS3 running in the Standard Job framework.
The Standard
cAWSS3 component belongs to the AWS and Connectivity families.
Basic settings
Connection |
Select an AWSS3 connection component from the list to reuse the |
Bucket Name |
Specify the name of the bucket, namely the top level folder, on |
The following options are available only when the cAWSS3 is used as a Producer: |
 |
Storage Class |
Select from Standard, Standard – Infrequent Access and |
Delete After Write |
Select this check box to delete the local file object after it is |
Multi Part Upload |
Select this check box to upload the file with multi part format, |
Server Side Encryption |
Select this option to encrypt the object on the server side using |
Message Headers |
Set the message headers in the corresponding table. Click Be sure to set the |
Use User Defined Headers |
Select this check box to set user defined headers in the |
The following options are available only when the cAWSS3 is used as a Consumer: |
 |
File Name |
Specify the name of the file to be consumed. |
Max Messages Per Poll |
The maximum number of objects that can be retrieved in one |
Prefix |
Specify the prefix of files so that only files with that prefix |
Delete After Read |
Select this check box to delete the object from the S3 service |
Include Body |
Select this check box to include the exchange body in the content |
Advanced settings
Advanced |
Set the optional parameters in the corresponding table. Click |
Usage
Usage rule |
cAWSS3 can be a start, middle or |
Limitation |
 n/a |
Sending messages to and receiving messages from Amazon’s S3 service
This scenario applies only to Talend Open Studio for ESB, Talend Data Services Platform and Talend Data Fabric.
This scenario will show you how to use the cAWSS3 component
to send messages to and consume messages from Amazon’s S3 service. To do this, two
Routes are built, a message producer Route, and a consumer Route. Messages are sent to
the Amazon’s S3 service in the producer Route and then consumed in the consumer
Route.
Building the producer Route
Dropping and linking the components
-
From the Palette, drag and drop a cAWSConnection, a cFile,
and a cAWSS3 component onto the design
workspace. -
Label the components for better identification of their roles and link
them with the Row > Route connection as shown above.
Configuring the components
-
Double-click the cAWSConnection component to display its
Basic settings view in the Component tab. -
In the Access Key and Secret
Key fields, enter the authentication credentials of your AWS
account. For how to get your Access Key and Access Secret, see Access keys (access key ID
and secret access key). -
Double-click the cFile component to open its Basic settings view in the Component tab.
-
In the Path field, browse to or enter the input file
path.In the fileName field, enter the name of file to be
uploaded to the S3 service.In this scenario, a TXT file with the name talend
that contains a simple string Hello World! is
used. -
Double-click the cAWSS3 component to open its Basic settings view in the Component tab.
-
In the Connection list, select the cAWSConnection component that you have just configured to
connect to Amazon’s S3 service.In the Bucket Name field, enter the name
of the bucket to upload the file,"talend-s3-demo"
in this use
case.Under the Message Headers table, click
[+] to add two rows in the table. Set
the header CamelAwsS3Key with the value
“talend.txt” as the name of the S3 object, and the
header CamelAwsS3ContentLength with the
value 5 to define the length of the object. - Press Ctrl+S to save your Route.
Viewing the code and executing the Route
-
Click the Code tab at the bottom of the
design workspace to check the generated code.As shown above, the message is routed froms3producer_cFile_1
to
s3producer_cAWSS3_1
. -
Press F6 to execute the Route. The logs
of the message exchange are printed in the console. -
In the Amazon’s S3 Web Console, you can see that the object
talend.txt has been created.
Building the consumer Route
Arranging the flow of the message
-
From the Palette, drag and drop a cAWSConnection, a cAWSS3
and a cProcessor component onto the design
workspace. -
Label the components for better identification of their roles and link
them with the Row > Route connection as shown above.
Configuring how the message is processed
-
Configure the cAWSConnection using the same properties
as in the producer Route. -
Double-click the cAWSS3 component to display its
Basic settings view in the Component tab. -
In the Connection list, select the cAWSConnection component to connect to Amazon’s S3 service.
In the Bucket Name field, enter the name
of the bucket that contains the file to be consumed,
"talend-s3-demo"
in this use case.In the File Name field, enter the name of the file,
“talend.txt”.Clear the Delete After Read check box to
keep the S3 object file after it is consumed. -
Double-click the cProcessor component to
display its Basic settings view in the
Component tab. -
In the Code box, enter the following code to print the
file name and its content in the execution
console:BufferedReader br = new BufferedReader(new InputStreamReader((InputStream) exchange.getIn().getBody()));
System.out.println("FileName: "+exchange.getIn().getHeader("CamelAwsS3Key")+" Content: " + br.readLine());
br.close();
- Press Ctrl+S to save your Route.
Executing the Route
-
Click the Code tab at the bottom of the
design workspace to check the generated code.As shown above, the message flow is routed froms3consumer_cAWSS3_1
and
processed bys3consumer_cProcessor_1
. -
Press F6 to execute the Route. The logs
of the message exchange are printed in the console.The content of the file isHello
as the length of the object
is defined to5
when uploading the file to the S3
service.