kapoor, 

is this helpful?  

http://camel.apache.org/loading-routes-from-xml-files.html

// load route from XML and add them to the existing camel 
contextInputStream is = getClass().getResourceAsStream("barRoute.xml"); 
RoutesDefinition routes = context.loadRoutesDefinition(is); 
context.addRouteDefinitions(routes.getRoutes()); 

~ RNPG 

On Feb 21, 2012, at 1:41, kapoor <borncoolr...@gmail.com> wrote:

> Hi thank you. I have a question.
> 
> I have my xml route like this,
> 
> camelcontext.xml:
> 
> <camelContext id="camel" trace="true" 
> xmlns="http://camel.apache.org/schema/spring";> 
> 
>          <dataFormats> 
>              <jaxb id="jaxb" contextPath="camelinaction"/> 
>          </dataFormats> 
> 
>          <route> 
>              <from uri="direct:order"/> 
>              <marshal ref="jaxb"/> 
>              <to uri="jms:queue:test.queue"/> 
>          </route> 
> 
>           </camelContext> 
> 
> in my service method:
> 
> public void jmstoroute()
> {
> 
> /**need to load xml at this point camelcontext.xml before sending object to
> direct:order */
> 
> PurchaseOrder order = new PurchaseOrder(); 
>        order.setName("Camel in Action"); 
>        order.setPrice(4995); 
>        order.setAmount(1); 
>        template.sendBody("direct:order", order); 
> 
> 
> }
> 
> My question:
> 
> In order to send it to direct:order first i need to load the my
> camelcontext.xml file. Am i right?
> How will i load the xml before sending object it to direct:order? My
> camelcontext.xml is located somewhere in my file system(outside project)
> mean?
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/error-while-using-direct-order-tp5498624p5501470.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to