camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Injecting data to routes loaded from xml file
Date Wed, 03 Aug 2011 06:14:38 GMT
On Tue, Aug 2, 2011 at 8:44 PM, rogelio_sevilla1
<rogelio.sevilla1@gmail.com> wrote:
> Thanks for the answer mr. Claus,  "myVar1"  is an instance member variable
> contained on the class that loads the xml route file.
>
> MyRouteClass extends RouteBuilder{
>
> *private String myVar1;
> //getter and setter for myVar1*
>
>
> public void configure() throws Exception {
>                    FileInputStream fis = new
> FileInputStream("myroute.xml");
>                    RoutesDefinition routes =
>  getContext().loadRoutesDefinition(fis);
>  }
>
> }
>
> And in my xml file i have this:
>
> <from uri="quartz://fetchUrl?cron=0+0/1+*+*+*+?"/>
>            <setProperty propertyName="coolProperty">
>                <simple>*myVar1*</simple>
>            </setProperty>
>
>
>
>
> I need to have the class written this way because each time i create an
> instance, i need to pass different values to it. Is it possible to send the
> values on the variable myVar1 to the routes defined on the spring file??
>

No not easily, instead you can insert the myVar value directly into
the xml file you are loading.

Or you can adjust it directly on the model classes from the
RoutesDefinition you get loaded, eg using the API from the
org.apache.camel.model classes.



>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Injecting-data-to-routes-loaded-from-xml-file-tp4639765p4659913.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message