You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Gabriel.DHalluin" <dh...@gmail.com> on 2012/02/15 08:53:54 UTC

Seda thread pool

Hello everyone,

I am looking for a way to use a common thread pool for different seda
endpoint. For now I have defined a custom thread pool in camel context
called after each seda endpoints. For example I have defined :
<camel:threadPool id="testPool" poolSize="10" maxPoolSize="100"/>
in camel context, this is used as followed: 

from("seda:testPool1?waitForTaskToComplete=Never")
.threads().executorServiceRef("testPool")
.to("testProcessor");

from("seda:testPool2?waitForTaskToComplete=Never&concurrentConsumers=3")
.threads().executorServiceRef("testPool")
.to("testProcessor2");

So in this case I have one thread for the first endpoint (and 3 for the
second endpoint) that are only used to consume the message recieved in seda
endpoint and pass it to the thread pool. I would like to know if it is
possible to avoid this 
by setting a custom thread pool shared by different seda endpoint.

Thank you very much,
Gabriel



--
View this message in context: http://camel.465427.n5.nabble.com/Seda-thread-pool-tp5485159p5485159.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Seda thread pool

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

This is not possible. A seda consumer is always active, so you cannot
really share a thread among seda endpoints.
So in your example, there will always be 1 + 3 active seda consumers,
that will take up 4 threads. The thread pools created by the seda
endpoints will be fixed sized. So that means there will be created 2
pools, the 1st have 1 in fixed size, and the 2nd have 3 in fixed size.

If you want to share a thread pool, then that pool must have at least
4 worker threads. So if we allow to share threads pools for seda
endpoints, we may want to add a check that there is a free worker
thread so the seda consumer can be active.




On Wed, Feb 15, 2012 at 8:53 AM, Gabriel.DHalluin
<dh...@gmail.com> wrote:
> Hello everyone,
>
> I am looking for a way to use a common thread pool for different seda
> endpoint. For now I have defined a custom thread pool in camel context
> called after each seda endpoints. For example I have defined :
> <camel:threadPool id="testPool" poolSize="10" maxPoolSize="100"/>
> in camel context, this is used as followed:
>
> from("seda:testPool1?waitForTaskToComplete=Never")
> .threads().executorServiceRef("testPool")
> .to("testProcessor");
>
> from("seda:testPool2?waitForTaskToComplete=Never&concurrentConsumers=3")
> .threads().executorServiceRef("testPool")
> .to("testProcessor2");
>
> So in this case I have one thread for the first endpoint (and 3 for the
> second endpoint) that are only used to consume the message recieved in seda
> endpoint and pass it to the thread pool. I would like to know if it is
> possible to avoid this
> by setting a custom thread pool shared by different seda endpoint.
>
> Thank you very much,
> Gabriel
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Seda-thread-pool-tp5485159p5485159.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/