I don't really want a new bean every time it is called. I just want one for each thread.
On Thu, Aug 12, 2010 at 1:22 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Thu, Aug 12, 2010 at 7:19 PM, Ron Smith <ronsmit...@gmail.com> wrote: > > I have created a route like this: > > > > from("tibco:queue:myqueue") > > .threads(10) > > .bean(StepOne.class, "handleMessage") > > .bean(StepTwo.class, "handleMessage") > > > > > > I had been testing my app without the threads(). After adding the > threads() > > I was surprised to find that it still only creates one instance of > StepOne > > and StepTwo and has all ten threads use those single instances. There is > > probably something in the docs somewhere that says that is how it works > but > > I must have missed it. I was surprised because I prefer to use separate > > instance of classes for each thread so I don't have to mess around with > > ThreadLocal, etc. and, of course, everyone thinks the same way as me :-) > > > > Is there an easy way to get camel to create separate instances for each > > thread? > > > > You can use Spring and have it use prototype scoped for the bean > > Or just use a Processor and new the bean yourself and invoke the method. > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >