0
votes

I want to read a file from a configured Amazon S3 bucket on certain event (example - a message in JMS queue). It seems that mule requester helps in these kind of situations for file, ftp, etc connectors. However, it appears that the scope of mulerequester is limited to transport connectors and not cloud connectors.

Can I use S3 as a resource for mulerequester?

<flow name="process_s3_file" doc:name="process_s3_file"
    processingStrategy="synchronous">
    <mulerequester:request config-ref="" resource="need-to-use-s3-get-object"
        doc:name="Mule Requester">          
    </mulerequester:request>

    <logger level="INFO" doc:name="Logger" />

    <!-- do something here -->

    <s3:delete-object config-ref="Amazon_S3"
        bucketName="${s3-read-bucket}" key="#[s3_file_name]" doc:name="Delete File"
        accessKey="${s3-access-key}" secretKey="${s3-secret-key}" />
</flow>

Here is the S3 get-object from where I want to request resource.

<s3:get-object-content config-ref="Amazon_S3" bucketName="${s3-read-bucket}"
            key="#[s3_file_name]" accessKey="${s3-access-key}"
            secretKey="${s3-secret-key}"
            doc:name="Read File" />
1

1 Answers

2
votes

It seems you don't need to have mulerequester for S3 connector. You can put it anywhere in the flow. The following flow worked for me.

<flow name="process_s3_file" doc:name="process_s3_file"
    processingStrategy="synchronous">
    <s3:get-object-content config-ref="Amazon_S3" bucketName="${s3-read-bucket}"
        key="#[s3_file_name]" accessKey="${s3-access-key}"
        secretKey="${s3-secret-key}"
        doc:name="Read File" />

       <logger level="INFO" doc:name="Logger" />

       <!-- do something here -->

       <s3:delete-object config-ref="Amazon_S3"
    bucketName="${s3-read-bucket}" key="#[s3_file_name]" doc:name="Delete File"
    accessKey="${s3-access-key}" secretKey="${s3-secret-key}" />    </flow>