Skip to content

CAMEL-23548: camel-aws2-s3 - allow Simple expressions in destinationB…#23334

Merged
davsclaus merged 1 commit into
apache:mainfrom
GuntherSchrijvers:CAMEL-23548-s3-simple-expressions-destination-prefix-suffix
May 20, 2026
Merged

CAMEL-23548: camel-aws2-s3 - allow Simple expressions in destinationB…#23334
davsclaus merged 1 commit into
apache:mainfrom
GuntherSchrijvers:CAMEL-23548-s3-simple-expressions-destination-prefix-suffix

Conversation

@GuntherSchrijvers
Copy link
Copy Markdown
Contributor

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

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change.

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.

  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@GuntherSchrijvers GuntherSchrijvers force-pushed the CAMEL-23548-s3-simple-expressions-destination-prefix-suffix branch from 7a96a3c to 20f43d7 Compare May 19, 2026 17:16
@GuntherSchrijvers GuntherSchrijvers force-pushed the CAMEL-23548-s3-simple-expressions-destination-prefix-suffix branch from 20f43d7 to d1a8eae Compare May 19, 2026 17:19
@GuntherSchrijvers GuntherSchrijvers force-pushed the CAMEL-23548-s3-simple-expressions-destination-prefix-suffix branch from d1a8eae to f8a8ee9 Compare May 19, 2026 17:22
@GuntherSchrijvers
Copy link
Copy Markdown
Contributor Author

Sorry for the force pushes: I accidentally used the wrong account to commit. It is solved now and I will not be doing any more.

@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-aws/camel-aws2-s3
All tested modules (9 modules)
  • Camel :: AWS2 Eventbridge
  • Camel :: AWS2 S3
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus merged commit 2f9be8a into apache:main May 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants