In spring integration aws application, files are routed from source folder to target S3 bucket using s3-outbound-gateway. Would like to encode the file UTF-8/16 using file-to-string-transformer and upload in target bucket. But the output file placed in target bucket is not encoding and the application does not throw error also.
Is there any thing am missing here and any other way to achieve this?
<file:file-to-string-transformer input-channel="fileswithoutencoding" output-channel="filesOutS3Transformer" charset="UTF-8"/>
<!-- added this line -->
<integration:transformer input-channel="filesOutS3Transformer" output-channel="filesS3GateWay" expression="payload.bytes" />
<int-aws:s3-outbound-gateway id="s3File"
request-channel="filesS3GateWay"
reply-channel="filesS3ChainChannel"
transfer-manager="transferManager"
bucket-expression = "headers.TARGET_PATH"
key-expression="headers.file_name"
command="UPLOAD">
<int-aws:request-handler-advice-chain>
<ref bean="retryAdvice" />
</int-aws:request-handler-advice-chain>
</int-aws:s3-outbound-gateway>
routing to Local File : File is encoded to UTF-8 format only using file to string transformer though the charset is 8/16/32.
<integration:chain id="filesOutChain" input-channel="filesOut">
<integration:transformer expression="headers.FILE"/>
<file:file-to-string-transformer charset="UTF-16"/>
<!-- though bytes conversion is not required,just added for testing purpose -->
<integration:transformer expression="payload.bytes"/>
<file:outbound-gateway id="fileMover"
auto-create-directory="true"
directory-expression="headers.TARGET_PATH"
mode="REPLACE">
<file:request-handler-advice-chain>
<ref bean="retryAdvice" />
</file:request-handler-advice-chain>
</file:outbound-gateway>
<integration:gateway request-channel="filesOutChainChannel" error-channel="errorChannel"/>
</integration:chain>