Re: dynamicly change the url of the element after the camelcontext is started

2013-10-08 Thread Babak Vahdat
Hi No you don't really need to override the first method you've mentioned below, as just overriding the second one is enough and does the job for you. See the link to the test I've already provided you in this thread. That said, in case you want to override the way how the system properties shoul

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-07 Thread salemi
Thank you Babak. It had to overwrite the following methods in order for Spring and Camel to work. public class MyBridgePropertyPlaceholderConfigurer extends BridgePropertyPlaceholderConfigurer{ @Override protected String resolvePlaceholder(String placeholder, Properties p

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-03 Thread Babak Vahdat
Hi, I just modified the test so that it better fits into your given use-case, e.g. now also the "from clause" contains a placeholder (as in your case): Test: https://github.com/apache/camel/blob/master/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringProperty

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-02 Thread Babak Vahdat
Hi Sorry for the confusion, given your concrete use-case I just added a test showing how you can achieve this "dynamic" behaviour: http://git-wip-us.apache.org/repos/asf/camel/diff/17f9678a Babak salemi wrote > Thanks Babak. > > When Spring comes up and it tries to resolve the properties for

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-02 Thread salemi
Thanks Babak. When Spring comes up and it tries to resolve the properties for the beans, it doesn't use the PropertiesResolver and it uses PropertyPlaceholderConfigurer's method called processProperties which uses a PlaceholderResolvingStringValueResolver and you can't overwrite it ! - Ali

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-01 Thread Babak Vahdat
You can reach/do the same there as well see the setter method: BridgePropertyPlaceholderConfigurer#setResolver Through which you can inject your own PropertiesResolver implementation. So to recapitulate, just implement you own PropertiesResolver by extending DefaultPropertiesResolver. Then implem

Re: dynamicly change the url of the element after the camelcontext is started

2013-10-01 Thread salemi
Thank you Babak. Since we are using Camel 2.10 we are using the BridgePropertyPlaceholderConfigurer as followed below: How does BridgePropertyPlaceholderConfigurer with the PropertiesComponent? Thanks, Ali - Alireza Salemi -- View this message in context: http://came

Re: dynamicly change the url of the element after the camelcontext is started

2013-09-30 Thread salemi
Hi Babak, Thank you for your quick respond. We tried the approach to override a property at the run time. It seem like if you set the uri attribute for the element then it become immutable! In our example we have defined the following elements in the camel context file

dynamicly change the url of the element after the camelcontext is started

2013-09-30 Thread salemi
Hi, During the camel startup, our code will query a database and retrieve the uri information for all the jms endpoints. I was wondering how can I overwrite the uri of the elements in example below? Ali - Alireza Salemi -- View this message in contex

Re: dynamicly change the url of the element after the camelcontext is started

2013-09-30 Thread Babak Vahdat
There's a also the following unit-test which should make the idea below clear to you (check the custom MyCustomResolver implementation): https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesResolverTest.java Babak Babak Vahdat wrot

Re: dynamicly change the url of the element after the camelcontext is started

2013-09-30 Thread Babak Vahdat
You can make use of the other PropertiesComponent method to pass over an array of locations upfront: PropertiesComponent.setLocations(String[] locations) So given your code example it would become: PropertiesComponent pc = new PropertiesComponent(); pc.setLocations(new String[] {"classpath

Re: dynamicly change the url of the element after the camelcontext is started

2013-09-30 Thread Babak Vahdat
Hi Ali, you could make use of the PropertiesComponent for this purpose: http://camel.apache.org/properties.html#Properties-ConfiguringinJavaDSL You can find lots of tests about using this component inside Spring DSL here: https://github.com/apache/camel/tree/master/components/camel-spring/src/t