oscerd opened a new pull request, #25315:
URL: https://github.com/apache/camel/pull/25315
## What
The dynamic-URI EIP `toD` computes its recipient endpoint uri from a
route-author expression at runtime (e.g. `toD("${header.target}")`), with no
way to restrict which component schemes the recipient may resolve to. This adds
an optional **`allowedSchemes`** attribute (comma-separated component-scheme
allow-list) on `ToDynamicDefinition`, wired through `ToDynamicReifier` into
`SendDynamicProcessor`.
A resolved recipient whose scheme is not in the list is rejected with a
`ResolveEndpointFailedException` — **independently of
`ignoreInvalidEndpoint`**, so a disallowed scheme always hard-fails. Default
unset = any scheme allowed, so there is **no behavioural change**. Useful for
low-code / Kamelet deployments that want to constrain e.g.
`.toD("${header.dest}")` to a fixed set of components.
```java
from("direct:start").toD().allowedSchemes("http,https").uri("${header.target}");
```
## Scope (MVP)
This is the **`toD`-only MVP** of CAMEL-24298. `wireTap` extends
`ToDynamicDefinition` and shares the reifier/processor path, so it inherits and
enforces the same option automatically. The 5 sibling dynamic-URI EIPs
(`recipientList`, `routingSlip`, `dynamicRouter`, `enrich`, `pollEnrich`) can
follow in separate PRs once this pattern is reviewed and accepted — so the JIRA
stays open after this merges.
## Tests
`ToDynamicAllowedSchemesTest`: an allowed scheme is sent; a disallowed
scheme is rejected with `ResolveEndpointFailedException`. Full-reactor `mvn
clean install -DskipTests` is green (model JSON, XML/YAML schemas, DSL
writers/parsers/deserializers, and the toD EIP doc regenerated).
## Docs
Added an `allowedSchemes` section to the toD EIP doc (Java + XML examples).
## Backport
**main only** — new additive feature (default unrestricted), not a bug fix.
Partially addresses CAMEL-24298 (toD MVP; sibling EIPs to follow).
---
_Claude Code on behalf of Andrea Cosentino (@oscerd)_
--
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]