i'm using Amazon S3 , My bucket have mutiple files in a input folder.i need to take all files in a folder and process it, right now i can able to take one file and process it by providing the key value. But not sure how to take all the files in a bucket (input is my folder name in a bucket) at a one shot. Please find my config below
<s3:config name="Amazon_S3" accessKey="myKey" secretKey="MySecretkey" doc:name="Amazon S3"/>
<flow name="s3Flow1" doc:name="s3Flow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" doc:name="HTTP"/>
<logger message="*********Inside yes************" level="INFO" doc:name="Logger"/>
<s3:list-objects config-ref="Amazon_S3" bucketName="getfiles" doc:name="Amazon S3" maxKeys="5" delimiter="/" prefix="input/"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<logger message="..InsidePay..#[payload]********" level="INFO" doc:name="Logger"/>
<s3:get-object-content config-ref="Amazon_S3" bucketName="my_backetName" key="input/test.xml" doc:name="Amazon S3"/>
<file:outbound-endpoint path="C:\OUT" responseTimeout="10000" doc:name="File" outputPattern="#[function:dateStamp].xml"/>
</flow>
When it try to add more files name or * value in Key =input/* . It is throwing error. Please help me on resolving the issue. Thanks in advance.
You need to get the object content for each file. For this you could use the
foreach
router and use#[payload.getKey()]
to get the current object's key: