Hi On Tue, Aug 4, 2009 at 10:53 PM, jjb<[email protected]> wrote: > > Hi. > > I need to do synchronous processing but not hold up routes of the same type > when many instances are active at the same time. Take the following bean > and route definitions from camel-context.xml: > > <bean id="processor" class="DerivedClass"/> > > ... > > <!-- begin camel context --> > <route> > <from uri="jetty:http://0.0.0.0:8080/test/?sessionSupport=true"/> > <to uri="bean:processor?method=process"/> > </route> > > And let's say I have a bunch of HTTP clients sending data at a high rate. > It seems if I want this route to be synchronous, all concurrent invocations > of the route will be serialized chronologically. Is there a way to force > Camel to create a new instance of DerivedClass (or better yet, grab one from > a pool) each time a client hits the route so one client doesn't block > another? >
The DerivedClass bean is controlled by Spring and its by default a singleton scoped. You can set its scope to prototype to let Spring return a new instance of it. If you need some sort of Object pooling then look at Spring documentation how to do that. > Regards > > -- > View this message in context: > http://www.nabble.com/creating-a-new-bean-per-route-invocation-tp24816036p24816036.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
