Search code examples
amazon-s3apache-camelapache-camel-aws

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


Solution

  • 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.