Aleksey Sushko created CAMEL-5438:
-------------------------------------

             Summary: Dynamic resolve property for CamelContext
                 Key: CAMEL-5438
                 URL: https://issues.apache.org/jira/browse/CAMEL-5438
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
    Affects Versions: 2.10.0
            Reporter: Aleksey Sushko


If you read the description of the camel http4 component you can find an 
example set of parameters for a consumer.
{code}
<camelContext>
  <properties>
    <property key="http.proxyHost" value="172.168.18.9"/>
    <property key="http.proxyPort" value="8080"/>
  </properties>
</camelContext>
{code}
In this example, the xml has no universal solution.
I think that the universal solution is to use a property placeholder. In this 
case, you can use an external configuration.
{code}
<camelContext>
  <properties>
    <property key="http.proxyHost" value="{{http.proxyHost}}"/>
    <property key="http.proxyPort" value="{{http.proxyPort}}"/>
  </properties>
</camelContext>
{code}
One possible solution is to replace the existing structure to access the 
property
{code}
String value = getCamelContext().getProprties().get("my_property");
{code}
Replace the call of the new method
{code}
String value = getCamelContext().getProprties("my_property");
{code}
Inside a method call to use the old design and a response sent to the method of 
resolvePropertyPlaceholders.

{code:title=An example of implementation}
public String getProperty(String name) { 
   String value = getProperties().get(name); 
   if(ObjectHelper.isNotEmpty(value)) 
      value = resolvePropertyPlaceholders(value); 
   return value; 
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to