Mule ESB: How to take all the files in a folder inside Bucket of Amazon S3 ( get object content) -
i'm using amazon s3 , bucket have mutiple files in input folder.i need take files in folder , process it, right can able take 1 file , process providing key value. not sure how take files in bucket (input folder name in bucket) @ 1 shot. please find 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 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 try add more files name or * value in key =input/* . throwing error. please me on resolving issue. in advance.
you need object content each file. use foreach
router , use #[payload.getkey()]
current object's key:
<s3:list-objects config-ref="amazon_s3" bucketname="getfiles" doc:name="amazon s3" maxkeys="5" delimiter="/" prefix="input/"/> <foreach doc:name="for each file"> <s3:get-object-content config-ref="amazon_s3" bucketname="my_backetname" key="#[payload.getkey()]" doc:name="amazon s3"/> </foreach>
Comments
Post a Comment