You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Olivier.Roger" <ol...@bsb.com> on 2010/10/19 11:33:46 UTC

[ThreadPool] Howto ?

Hello Camel,

I am trying to use a Thread Pool inside my route to call an external process
(with camel-exec).
to avoid overloading the server with request I wanted to created a fixed
size thread pool to handle those calls.

I expected multiple messages (up to 25 (maxpoolsize)) to be handled
simultaneously. 
But I must have misunderstood something because It appears only 1 requested
is handled at the time

Here is my thread pool definition

		<threadPool id="myPool" threadName="test"
					poolSize="15" maxPoolSize="25" maxQueueSize="250"/>

I use it in three different locations in the route like this 

	<threads executorServiceRef="myPool">
		<to	uri="exec:Batch1.bat" /> <!-- same for 2 and 3 -->
	</threads>


-- 
View this message in context: http://camel.465427.n5.nabble.com/ThreadPool-Howto-tp3218747p3218747.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [ThreadPool] Howto ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 19, 2010 at 5:31 PM, Olivier.Roger <ol...@bsb.com> wrote:
>
> The consumer is a JMS queue,
>
> Does setting a number of consumer on it would have the expected effect ?

Yes it will have the effect. In fact with that you do not need the
thread pool stuff.


>
> I will check and see what thread is used for the exec call and get back to
> you.
> --
> View this message in context: http://camel.465427.n5.nabble.com/ThreadPool-Howto-tp3218747p3219243.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: [ThreadPool] Howto ?

Posted by "Olivier.Roger" <ol...@bsb.com>.
The consumer is a JMS queue,

Does setting a number of consumer on it would have the expected effect ?

I will check and see what thread is used for the exec call and get back to
you.
-- 
View this message in context: http://camel.465427.n5.nabble.com/ThreadPool-Howto-tp3218747p3219243.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [ThreadPool] Howto ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 19, 2010 at 11:33 AM, Olivier.Roger <ol...@bsb.com> wrote:
>
> Hello Camel,
>
> I am trying to use a Thread Pool inside my route to call an external process
> (with camel-exec).
> to avoid overloading the server with request I wanted to created a fixed
> size thread pool to handle those calls.
>
> I expected multiple messages (up to 25 (maxpoolsize)) to be handled
> simultaneously.
> But I must have misunderstood something because It appears only 1 requested
> is handled at the time
>
> Here is my thread pool definition
>
>                <threadPool id="myPool" threadName="test"
>                                        poolSize="15" maxPoolSize="25" maxQueueSize="250"/>
>
> I use it in three different locations in the route like this
>
>        <threads executorServiceRef="myPool">
>                <to     uri="exec:Batch1.bat" /> <!-- same for 2 and 3 -->
>        </threads>
>

Usually concurrency comes from the consumer. eg a web server can
service multiple requests concurrently.

What version of Camel are you using? And whats your consumer?

If you check the log you should be able to see at least its a thread
from the pool which processes the exec stuff (eg the stuff you got
inside the thread pool)


>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ThreadPool-Howto-tp3218747p3218747.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