Claus Ibsen created CAMEL-10388: ----------------------------------- Summary: Dynamic update predicate/expression at runtime Key: CAMEL-10388 URL: https://issues.apache.org/jira/browse/CAMEL-10388 Project: Camel Issue Type: New Feature Components: camel-core Reporter: Claus Ibsen Fix For: Future
When using expression and predicates in your routes, then they are created once during startup of Camel. It may be desirable to allow dynamic updating these at runtime based on a configuration parameter change configured from a property placeholder. For example {code:xml} <from ...> <filter> <simple>{{auditEnabled}}</simple> <to uri="{{auditUrl}}"/> </filter> ... {code} In this example the simple predicate in the filter should be automatic updated if the property placeholder value changes. This requires 1. Properties component to support notification of value changes (SPI hook) 2. Predicate/Expression Factory in camel-core 3. Creating all expression/predicates using the factory 4. Option to turn this feature on (off by default) 5. If the option is on, then the factory creates the expression/predicate with a wrapper that hooks into the notification event and listen on changes. If a change happens, then expression/predicate is re-created and swapped out with the existing. There should not be a global lock, so the changes happens as-is and they are not atomic. So end users should just beware, that if you do multiple property changes then depending on concurrency then at any given time some predicates/expression may be updated while others are still using old values. We can optimize so they only update if the property placeholder key is used by the expression/predicate. Notice that endpoints is not supported. For those to updates you would need to restart/re-create the route. Or use dynamic-to. For the consumer we could consider a way for it to allow to auto restart by doing a route stop/update/start. However this is a slipping stope. As having immutable containers and leaving updates to be done by a platform is better/safer. -- This message was sent by Atlassian JIRA (v6.3.4#6332)