Dear Bilgin,  That really really helped.  Atlast, I found what I wanted.  
Thanks very much.
Syed.

Date: Sun, 21 Jul 2013 09:53:55 -0700
From: ml-node+s465427n5735973...@n5.nabble.com
To: syedahmed.c...@hotmail.com
Subject: Re: New Instance of CamelContext from Spring



        CamelContextFactoryBean creates CamelContext as a singleton and its

reference is cached by Spring.


It might be easier for you if you a factory for creating new

CamelContext and you prefer you can still reuse the same route

definitions from Spring XML in each new CamelContext.

Something like this:



    public static ModelCamelContext createContext() throws Exception {

        ClassPathXmlApplicationContext applicationContext = new

ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");

        List<RouteDefinition> routeDefinition =

(List<RouteDefinition>) applicationContext.getBean("routes");

        ModelCamelContext camelContext = new

SpringCamelContext(applicationContext);

        camelContext.addRouteDefinitions(routeDefinition);

        return camelContext;

    }


And define the routes in a routeContext



    <camel:routeContext id="routes"

xmlns="http://camel.apache.org/schema/spring";>

        <route id="one">

            <from uri="file:src/data?noop=true"/>

            <log message="hello"/>

        </route>

    </camel:routeContext>



HTH

Bilgin


On 21 July 2013 07:13, SyedBhai <[hidden email]> wrote:

> Nope, it did not help.  Can someone share the answer please if you have?

>

> Thanks,

> Syed.

>

>

>

> --

> View this message in context: 
> http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735956.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



        
        
        
        

        

        
        
                If you reply to this email, your message will be added to the 
discussion below:
                
http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735973.html
        
        
                
                To unsubscribe from New Instance of CamelContext from Spring, 
click here.

                NAML
                                                  



--
View this message in context: 
http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to