简体   繁体   中英

Logging filename during file transfer from aws s3 using apache camel

I am a beginner to Apache camel-aws. I am writing a program to transfer a file from one aws s3 bucket to another bucket using apache camel. I now want to log the file/object name that is being picked from s3. Could you please help me with the same? Below is my code snippet. ${file:name} works for camel FTP component, want to understand its equivalent in aws.

from("aws-s3://sourceBucket?amazonS3Client=#amazonS3Client")
                .log("The following file has been picked for file transfer    : ${file:name}")
                .routeId("Test My Files").log("Building Destination URI for fie transfer")
                .to("aws-s3://destinationBucket?amazonS3Client=#amazonS3Client")
                .log("The following file transfer has completed   : ${file:name}");

Kind regards, Kashif

No it's not the same.

You need to use the header CamelAwsS3Key

.log("The following file has been picked for file transfer: ${header.CamelAwsS3Key}")

This is set while consuming from S3 Bucket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM