Hi If you use Spring or some other bean container, then you can define the bean in spring, and declare it as prototype scope, then a new instance is created each time Camel uses the bean.
On Wed, Apr 4, 2012 at 7:04 PM, maticpetek <[email protected]> wrote: > Hello, > I'm using Java DSL and my route looks something like this : > > RouteBuilder rb = new RouteBuilder() { > public void configure() { > from("direct:testRoute") > .routeId("r1") > .split(body().tokenize(",")) > .streaming() > .parallelProcessing() > .to("stream:err") > .bean(MyBeanClass.class, "camelSpider") > .to("stream:err") > ; > } > }; > context.addRoutes(rb); > template.sendBody("direct:receptRoute", "Work1,Work2,Work3,Work4"); > > Message "Work1,Work2,Work3,Work4" will be split on 4 routes and every route > will be executed in parallel and method "camelSpider" will be called on > MyBeanClass. > But what I would like to do is that every route will have new instance of > MyBeanClass, not the some instance (Singleton design pattern). Any idea how > to do this? Thank you > > Regards, > Matic > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Route-split-bean-method-call-and-new-bean-instance-tp5618418p5618418.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
