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

   Implements [CAMEL-25112](https://issues.apache.org/jira/browse/CAMEL-25112).
   
   The properties component keeps local properties, such as the parameters of a 
route template used while a route is created from that template. Since 
CAMEL-21675 they have been held in a single stack shared by all threads, 
although the javadoc says they are local to the current thread. Camel starts 
routes in a thread-safe way itself. This change prepares for adding routes 
dynamically from multiple threads by making the local properties per thread 
again.
   
   ## Changes
   - **`PropertiesComponent`:** the local properties are a per-thread stack. 
The thread-local entry is removed when the stack becomes empty.
   - **`DefaultCamelContext`:** when starting routes, the local properties are 
removed only for a route that added them, which is a route created from a route 
template. Previously every route removed them, including ones the caller had 
added.
   - **camel-main:** `camel.aiObservability.enabled` is now set as an override 
property instead of a local property.
     - The local property was never removed. It was lost as soon as routes were 
started (see above), and other threads could not see it.
     - As a result, `aiObservability().withEnabled(false)` did not disable 
GenAI observability when there were routes.
   
   ## Tests
   - **New `PropertiesComponentLocalPropertiesThreadTest`** (camel-core):
     - local properties are not seen by other threads;
     - adding a route that is not from a route template keeps the caller's 
local properties.
   - **`AiObservabilityConfigurationPropertiesTest`:** extended to cover a Main 
with routes, checked from another thread.
   - **Without the fix:** all three new tests fail.
   - **Full suites:** camel-core, camel-management and camel-main, with their 
upstream modules, 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