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

   [CAMEL-27160](https://issues.apache.org/jira/browse/CAMEL-27160)
   
   This finishes the work of @oscerd in #30340 and addresses the open review 
points there. His two commits are kept, and this PR supersedes #30340.
   
   The dynamic-endpoint EIPs compute their endpoint uri from the current 
message: `toD`, `enrich`, `wireTap`, `pollEnrich`, `recipientList`, 
`routingSlip` and `dynamicRouter`. The option values of such an endpoint are 
now bound as literal text.
   - A property placeholder (`{{...}}`), a `#class:` value or a `#property:` 
value is not resolved.
   - A `RAW(...)` value is unwrapped, but a `$simple{...}` in it is not 
evaluated.
   - Registry references (`#bean:`, `#type:`, `#name`) are still resolved, so 
`toD("sql:${header.q}?dataSource=#ds")` keeps working.
   
   ## Changes compared to #30340
   - **Where the scope opens:** the CamelContext opens the literal binding 
scope (try/finally) around the regular `Component#createEndpoint(String, Map)`.
     - So the component and endpoint overrides (`createEndpoint`, 
`setProperties`, `configureProperties`) are called as before.
     - The three-argument `createEndpoint` and `setProperties` methods on 
`DefaultComponent` and `DefaultEndpoint` are removed again.
   - **Every binding path follows the scope:**
     - `PropertyBindingSupport` binds in literal mode however it is called: the 
`setProperties(Object, Map)` overloads, and components that call it directly.
     - `EndpointHelper.resolveReferenceParameter` and 
`PropertyBindingSupport.resolveBean` refuse a placeholder, `#class:` or 
`#property:` value.
     - This covers the generated configurers of options that are not a String, 
and `resolveAndRemoveReferenceParameter`.
   - **Names:** in literal mode, option names are not resolved as placeholders, 
and `DefaultRegistry` does not resolve placeholders in a bean name.
   - **`RAW()` values:**
     - `RawParameterHelper` reads the scope, so a `RAW(...)` value is unwrapped 
but `$simple{...}` in it is not evaluated.
     - The optimised `SendDynamicAware` and `PollDynamicAware` paths do the 
same; for example the `toD` of the http components.
     - Endpoints written in the route still evaluate `RAW($simple{...})`. In a 
`toD` uri, use `RAW({{env:X}})`, which is resolved when the route is created.
   - **Javadoc:** corrected, since `#bean:` and `#type:` are resolved.
   
   ## Upgrade note
   - **Which options:** every option of the per-message uri is affected, 
including the static `toD` text.
   - **`#class:`:** for an option that is not a String, a `#class:` value fails 
endpoint creation. Use `#bean:` with a bean defined elsewhere.
   - **`RAW($simple{...})`:** in a `toD` uri, use `RAW({{env:X}})` instead.
   - **Docs:** a note in `endpoint.adoc` under "Using ENV variables with raw 
values".
   
   ## Tests
   - **`DynamicEndpointMessageOptionLiteralLogTest` (new)** uses the `log` 
component: a generated configurer, typed options, 
`resolveAndRemoveReferenceParameter`, `setProperties(Object, Map)`, and the 
`stub` override.
   - **`DynamicEndpointMessageOptionLiteralTest`** gets more cases: `#type:`, 
an option name placeholder, and a singleton endpoint.
   - **`DynamicEndpointMessageRawOptionTest` (new):**
     - in a `toD`, a `RAW($simple{...})` from the message stays literal, for a 
system property, the environment, a bean method and the CamelContext;
     - static endpoints still evaluate it;
     - `RAW({{...}})` in the `toD` text is still resolved;
     - the `SendDynamicAware` and `PollDynamicAware` helpers take the value as 
literal.
   - **`HttpSendDynamicAwareRawSimpleTest` (new)** goes through the optimised 
http `toD` path.
   - **Without the change:** on the head of #30340, 6 of the literal-binding 
tests fail, and so do 6 `RAW()` tests and the http test.
   - **Runs:** camel-core (9639 tests), camel-support, camel-sql, the toD tests 
of camel-kamelet, and the camel-http `SendDynamicAware` tests all pass.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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