You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by alexey-s <al...@mail.ru> on 2012/07/09 00:57:18 UTC

initialize camelContext properties

Hi

I read "Using proxy settings outside of URI" in
http://camel.apache.org/http4.html

<camelContext>
  <properties>
    <property key="http.proxyHost" value="172.168.18.9"/>
    <property key="http.proxyPort" value="8080"/>
  </properties>
</camelContext>

I read "Using Blueprint property placeholder with Camel routes" in
http://camel.apache.org/properties.html 
But I have not found a real example of the settings camelContext properties
from blueprint properties.


<cm:property-placeholder persistent-id="myblueprint.placeholder">
  <cm:default-properties>
    <cm:property name="http.proxyHost" value=""/>
    <cm:property name="http.proxyPort" value=""/>
  </cm:default-properties>
</cm:property-placeholder>

<camelContext>
  <properties>
    <property key="http.proxyHost" value="{{http.proxyHost}}"/>
    <property key="http.proxyPort" value="{{http.proxyPort}}"/>
  </properties>
  ...
</camelContext>

Easy to use text values ​​does not allow flexibility settings.


---
Aleksey Sushko

--
View this message in context: http://camel.465427.n5.nabble.com/initialize-camelContext-properties-tp5715695.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: initialize camelContext properties

Posted by alexey-s <al...@mail.ru>.
Hi, Willem.

I added a ticket CAMEL-5438

---
Aleksey Sushko

--
View this message in context: http://camel.465427.n5.nabble.com/initialize-camelContext-properties-tp5715695p5715887.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: initialize camelContext properties

Posted by Willem Jiang <wi...@gmail.com>.
Yes, current camel property component doesn't support resolve the 
property value dynamically.
Do you mind to create a JIRA for it, I will work on this issue later 
this week.

On Wed Jul 11 05:25:40 2012, alexey-s wrote:
> I propose to replace the current structure
> getCamelContext (). getProprties (). get("my_property")
> to the new method
> getCamelContext (). getProperty("my_property")
>
> The implementation of this method will produce an automatic substitution
> values ​​using property placeholders.
>
> String getProperty (String name) {
>     String value = getProperties().get(name);
>     if (ObjectHelper.isNotEmpty (proxyUrl))
>        value = resolvePropertyPlaceholders (value);
>     return value;
> }
>
> Almost universally used property placeholders. Only in this place, this
> mechanism is not in use.
>
> For example, "Using proxy settings outside of URI", have no universal
> solution. For each installation of the system must collect a unique jar
> (OSGi bundle).
>
> See also
> https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+configure+the+default+maximum+cache+size+for+ProducerCache+or+ProducerTemplate
> In this example, the xml has no universal solution. In Java DSL parameter
> can be specified dynamically. In the xml this parameter is static.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/initialize-camelContext-properties-tp5715695p5715822.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: initialize camelContext properties

Posted by alexey-s <al...@mail.ru>.
I propose to replace the current structure
getCamelContext (). getProprties (). get("my_property")
to the new method
getCamelContext (). getProperty("my_property")

The implementation of this method will produce an automatic substitution
values ​​using property placeholders.

String getProperty (String name) {
   String value = getProperties().get(name);
   if (ObjectHelper.isNotEmpty (proxyUrl))
      value = resolvePropertyPlaceholders (value);
   return value;
}

Almost universally used property placeholders. Only in this place, this
mechanism is not in use.

For example, "Using proxy settings outside of URI", have no universal
solution. For each installation of the system must collect a unique jar
(OSGi bundle).

See also
https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+configure+the+default+maximum+cache+size+for+ProducerCache+or+ProducerTemplate
In this example, the xml has no universal solution. In Java DSL parameter
can be specified dynamically. In the xml this parameter is static.

--
View this message in context: http://camel.465427.n5.nabble.com/initialize-camelContext-properties-tp5715695p5715822.html
Sent from the Camel - Users mailing list archive at Nabble.com.