have written code for spring integration aws application, which currently upload files from source folder to target S3 bucket using s3-outbound-gateway. Would like to add below user defined metadata and their value about the file while uploading the file in S3 bucket.
x-amz-meta-sourcePath : /test
x-amz-meta-targetPath :/targetbucket/
x-amz-meta-timestamp : (#timestamp value)
Would like to know how to add metadata using S3 outbound gateway or other way. Any documentation/example/suggestion will be helpful to achieve this.
<util:map id="userMetadata" value-type="java.lang.String">
<entry key="x-amz-meta-source" value="testsource" />
<entry key="x-amz-meta-sourcePath" value="testpath" />
<entry key="x-amz-meta-targetPath" value="headers.TARGET_PATH" /> </util:map>
<bean id="objectMetadata" class="com.amazonaws.services.s3.model.ObjectMetadata">
<property name="userMetadata" ref="userMetadata"/>
</bean>
<bean id="uploadMetadataProvider" class="org.springframework.integration.aws.outbound.S3MessageHandler$UploadMetadataProvider">
<property name="objectMetadata" ref="objectMetadata"/>
</bean>
<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"
upload-metadata-provider="uploadMetadataProvider"
command="UPLOAD">
<int-aws:request-handler-advice-chain>
<ref bean="retryAdvice" />
</int-aws:request-handler-advice-chain>
</int-aws:s3-outbound-gateway>
S3Object
? Maybe anupload-metadata-provider
is answer for you? – Artem Bilan