You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by DanD <DD...@UP.COM> on 2010/02/01 14:43:34 UTC

Controlling Threads

Hi, I need to control the number of threads processing messages in a camel
route.  I'm using the Spring DSL and Apache Camel 2.1.0 for my routes.  In a
boiled-down nutshell, my route looks like this.  Names of contexts, routes
and endpoints have been changed to protect the innocent =)

<!-- Used in the deployed system to connect one system to another via JMS
-->
<camelContext id="jms-input">
   <route>
       <from uri="jms:queue:some-input-queue"/>
       <!-- elided -->
       <to uri="vm:common-processor"/>
   </route>
</camelContext>

<camelContext id="common-processing-steps">
   <route>
      <from uri="vm:common-processor/>
      <!-- A bunch of stuff goes on here, elided -->
      <to uri="vm:some-customer-specific-processor-via-recipientList"/>
   </route>
</camelContext>

<camelContext id="some=customer-specific-processor">
   <route>
      <from uri="vm:some-customer-specific-processor"/>
      <!-- elided -->
   </route>
</camelContext>

I would like to limit threading in this model to two in each of the 3
routes.
-- 
View this message in context: http://old.nabble.com/Controlling-Threads-tp27404394p27404394.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Controlling Threads

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Feb 1, 2010 at 4:10 PM, DanD <DD...@up.com> wrote:
>
> Hi and thank you for your reply.  As I'm on 2.1 and 2.2 doesn't seem to be
> out yet and 2.3 must be down the road, what can I do for now as this system
> is live?  I'm already getting OutOfMemory exceptions due to more throughput
> them I'm ready to handle.
>

That must be because you intake more than you can handle.
I recon its the VM endpoints you let others just send a zillion of message to.
As the JMS endpoint is only using 1 consumer.

You can use the throttler EIP to limit the flow.
http://camel.apache.org/throttler

And in 2.1 you can use RoutePolicy to dynamic throttle routes based on
eg. metrics you can gather such as memory usage or number of messages
currently in flight etc.
http://camel.apache.org/route-throttling-example.html


>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Having some slick configuration for thread pools configuration is on
>> the roadmap for 2.3.
>>
>> Currently each of the routes will use the number of thread you specify
>> on the consumer, eg in the JMS consumer you have 1 thread by default.
>> The same goes for the VM endpoint.
>>
>>
>> --
>> 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
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Controlling-Threads-tp27404394p27405736.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
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

Re: Controlling Threads

Posted by DanD <DD...@UP.COM>.
Hi and thank you for your reply.  As I'm on 2.1 and 2.2 doesn't seem to be
out yet and 2.3 must be down the road, what can I do for now as this system
is live?  I'm already getting OutOfMemory exceptions due to more throughput
them I'm ready to handle.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Having some slick configuration for thread pools configuration is on
> the roadmap for 2.3.
> 
> Currently each of the routes will use the number of thread you specify
> on the consumer, eg in the JMS consumer you have 1 thread by default.
> The same goes for the VM endpoint.
> 
> 
> -- 
> 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
> 
> 

-- 
View this message in context: http://old.nabble.com/Controlling-Threads-tp27404394p27405736.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Controlling Threads

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Having some slick configuration for thread pools configuration is on
the roadmap for 2.3.

Currently each of the routes will use the number of thread you specify
on the consumer, eg in the JMS consumer you have 1 thread by default.
The same goes for the VM endpoint.


On Mon, Feb 1, 2010 at 2:43 PM, DanD <DD...@up.com> wrote:
>
> Hi, I need to control the number of threads processing messages in a camel
> route.  I'm using the Spring DSL and Apache Camel 2.1.0 for my routes.  In a
> boiled-down nutshell, my route looks like this.  Names of contexts, routes
> and endpoints have been changed to protect the innocent =)
>
> <!-- Used in the deployed system to connect one system to another via JMS
> -->
> <camelContext id="jms-input">
>   <route>
>       <from uri="jms:queue:some-input-queue"/>
>       <!-- elided -->
>       <to uri="vm:common-processor"/>
>   </route>
> </camelContext>
>
> <camelContext id="common-processing-steps">
>   <route>
>      <from uri="vm:common-processor/>
>      <!-- A bunch of stuff goes on here, elided -->
>      <to uri="vm:some-customer-specific-processor-via-recipientList"/>
>   </route>
> </camelContext>
>
> <camelContext id="some=customer-specific-processor">
>   <route>
>      <from uri="vm:some-customer-specific-processor"/>
>      <!-- elided -->
>   </route>
> </camelContext>
>
> I would like to limit threading in this model to two in each of the 3
> routes.
> --
> View this message in context: http://old.nabble.com/Controlling-Threads-tp27404394p27404394.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
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