GuntherSchrijvers opened a new pull request, #23334:
URL: https://github.com/apache/camel/pull/23334
# Description
The `camel-aws2-s3` consumer supports a `moveAfterRead` option that copies
consumed objects to a destination bucket. The `destinationBucketPrefix` and
`destinationBucketSuffix` options allow customising the destination key, but
previously only accepted literal strings.
This PR adds Simple expression language support to both options, following
the same pattern already used by `AWS2S3Utils.determineKey()` and
`AWS2S3Utils.determineBucketName()`: `LanguageSupport.hasSimpleFunction()`
detects whether the value contains a `${...}` expression; if so, the `"simple"`
language is resolved from the Camel context and evaluated against the current
exchange.
Literal strings and `null`/empty values continue to behave exactly as
before, so existing routes using `RAW(somePrefix)` are unaffected.
A practical use case is organising moved objects by date:
```
aws2-s3://mybucket?moveAfterRead=true&destinationBucket=archive
&destinationBucketPrefix=RAW(${date:now:yyyy/MM/dd}/)
```
Changes:
- `AWS2S3Utils`: two new static helpers `evaluateDestinationBucketPrefix` /
`evaluateDestinationBucketSuffix`
- `AWS2S3Consumer.processCommit()`: uses the new helpers instead of plain
string concatenation
- `AWS2S3UtilsTest`: 6 new unit tests (literal pass-through, Simple
expression evaluation, null/empty for prefix and suffix)
- `aws2-s3-component.adoc`: documents expression support with a static and a
dynamic date example
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4
uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL-23548)
filed for the change.
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful
subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally from root folder
and I have committed all auto-generated changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]