oscerd opened a new pull request, #25569:
URL: https://github.com/apache/camel/pull/25569

   Fixes [CAMEL-24414](https://issues.apache.org/jira/browse/CAMEL-24414).
   
   > **This PR reverses a decision documented in the 4.22 upgrade guide, and 
inverts four tests that pinned it.** That is deliberate; the reasoning and the 
evidence are below. Please read the "Why the 4.22 rationale does not hold" 
section before anything else — if you disagree with it, the rest of the PR is 
moot.
   
   ## What changes
   
   CAMEL-24282 stopped resolving `{{...}}` on the *per-message evaluated* 
recipient for `toD` and `enrich`, and left `recipientList`, `routingSlip`, 
`dynamicRouter` and `pollEnrich` alone. This aligns those four.
   
   All of them share `ProcessorHelper.prepareRecipient`, which ended in:
   
   ```java
   return ecc.getCamelContextExtension().normalizeUri(uri);   // -> 
resolveEndpointUriPropertyPlaceholders
   ```
   
   so a `{{...}}` token appearing only in the runtime value was expanded 
against the application's property sources. Changing the shared helper covers 
**RoutingSlip's asynchronous continuation path** (`RoutingSlip.java:469`) as 
well as the synchronous one (`:265`) — worth noting, since that async path has 
been missed before.
   
   ## Why the 4.22 rationale does not hold
   
   The 4.22 guide justified the exclusion this way:
   
   > *"recipientList, routingSlip and dynamicRouter are unchanged: their 
recipients are computed entirely from a runtime expression (there is no static 
template resolved at build time), so they continue to resolve {{...}} in the 
computed recipient."*
   
   The implication is that the per-message path is the **only** way to use a 
placeholder with these EIPs, so removing it would take a legitimate capability 
away. I tested that rather than assuming it. **With this change applied**, a 
route written as
   
   ```java
   from("direct:rlConstant").recipientList(constant("mock:{{secretTarget}}"))
   ```
   
   **still reaches `mock:resolved`** — the placeholder is resolved at build 
time by the model, independently of the per-message path.
   
   So the exclusion protected nothing. Removing the per-message expansion only 
stops expanding placeholders that arrive **in message content**, which is what 
the contract says should never happen. That check is now a permanent test: 
`recipientListPlaceholderInRouteTextIsResolved`.
   
   `pollEnrich` needs no argument at all — the 4.22 guide already says aligning 
it "is deferred to a follow-up". This is that follow-up.
   
   ## Tests
   
   `DynamicEndpointMessagePlaceholderTest` goes from 7 to 8 tests. The four 
`...StillResolved` tests become `...NotResolved`, and the new route-text test 
is added. All 8 pass.
   
   ```
   mvn test -Dtest=DynamicEndpointMessagePlaceholderTest   # 8 passed
   mvn clean install -DskipTests                           # full reactor, 
BUILD SUCCESS
   ```
   
   ## Scope I deliberately left out
   
   - `SendDynamicProcessor` keeps its own `prepareRecipient`, because it 
additionally validates that the URI has a scheme and a path. It is now a 
near-duplicate of the shared helper; folding them together is worth doing but 
is a separate behaviour change and belongs in its own PR.
   - The 4.22 guide text is untouched — it accurately describes what 4.22 
shipped. The correction lives in the 4.23 entry.
   
   ## Backport
   
   **main only**, matching CAMEL-24282's own main-only policy. Behaviour 
change, upgrade-guide entry included.
   
   ---
   _Claude Code on behalf of 


-- 
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]

Reply via email to