16.2. Usage examples
You could consume the bucket content and directly delete the object once consumed
- route:
from:
uri: "kamelet:aws-s3-source"
parameters:
useDefaultCredentialsProvider: true
region: "eu-west-1"
bucketNameOrArn: "kamelets"
steps:
- to:
uri: "kamelet:log-sink"
This kind of approach ensures that the object is consumed just one time and after the consumption it is deleted from the S3 bucket.
The deleteAfterRead property is true by default.
If you set the property to false you’ll consume the same set of objects multiple times and you’ll have to deal with managing the situation.
The ignoreBody option is set to false by default, but you can enable it. With that option set you’re going to ignore the file payload and just consume the object metadata.
You could also define a prefix parameter. With that set you’re going to consume only files starting with that prefix. As an example you could have:
- route:
from:
uri: "kamelet:aws-s3-source"
parameters:
useDefaultCredentialsProvider: true
region: "eu-west-1"
bucketNameOrArn: "kamelets"
prefix: "foo/"
steps:
- to:
uri: "kamelet:log-sink"
By using the prefix foo/ the files consumed will only come from the folder named foo.