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 <[email protected]> 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.