You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mccabejj <mc...@gmail.com> on 2012/04/17 04:20:02 UTC

WireTap - Defining custom ThreadPoolProfile

Hello,

Camel Version: 2.8.2

I am trying to setup a custom ThreadPoolProfile (Spring DSL) for the WireTap
calls in our routes.  Based on the 
http://camel.apache.org/threading-model.html Threading Model Documentation 
it should look something like this:

<threadPoolProfile id="customThreadPoolProfile" poolSize="10"
maxPoolSize="20" maxQueueSize="-1"/>

And then the WireTap on the route should look something like this:
<wireTap uri="direct:gateway/services/LogRequestDesktop"
executorServiceRef="customThreadPoolProfile"/>

However, when I define it this way in the CamelContext and fire it up, Camel
is unable to load the route due to the inability to find a threadPoolProfile
with the defined id.  If I inspect/debug the running CamelContext I do not
see the custom threadPoolProfile reference.

If I change it to the following then Camel finds the threadPoolProfile and
it works.  However, this isn't really what I want since I'd like for the
custom profile to only apply for the WireTaps.

<threadPoolProfile id="customThreadPoolProfile" poolSize="10"
maxPoolSize="20" maxQueueSize="-1" defaultProfile="true"/>

What am I doing wrong?  Thanks in advance.

JM



--
View this message in context: http://camel.465427.n5.nabble.com/WireTap-Defining-custom-ThreadPoolProfile-tp5645423p5645423.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: WireTap - Defining custom ThreadPoolProfile

Posted by mccabejj <mc...@gmail.com>.
OK, makes sense.  Thanks a lot for the explanation.

JM

--
View this message in context: http://camel.465427.n5.nabble.com/WireTap-Defining-custom-ThreadPoolProfile-tp5645423p5647983.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: WireTap - Defining custom ThreadPoolProfile

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Apr 17, 2012 at 2:57 PM, mccabejj <mc...@gmail.com> wrote:
> Thanks Claus.  Switching to ThreadPool instead of ThreadPoolProfile worked.
>
> Another quick (hopefully) question on Thread Pools in Camel.  I think I've
> observed that there are multiple ThreadPoolExecutor's created for each
> route.  It seems to be 1 for every WireTap present on the route.  So if I
> have 3 routes with 3 wiretaps each then there are 9 ThreadPoolExecutor
> instances each with N number of available threads based on the profile.
>
> Is this expected?  If so, I guess this is ok...?
>

Yes by default the wire taps uses an exclusive thread pool.

If you want to use a shared pool among the wire taps, you have to
configure a <threadPool>
and then assign that to each <wireTap> so they use the shared pool.

On the other hand if you use <threadPoolProfile> then that is just a
'template' which has
settings for creating new thread pools.

Thats the difference between <threadPool> and <threadPoolProfile>



> I think this was noted by someone else in the following post:
> http://camel.465427.n5.nabble.com/WireTap-threads-number-keeps-on-growing-td5557827.html
> /"I now understand that each route has its own pool. So I have (10 *
> #schedules) threads of wiretap."/
>
> Thanks again for the great community support.
>
> JM
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/WireTap-Defining-custom-ThreadPoolProfile-tp5645423p5646502.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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/

Re: WireTap - Defining custom ThreadPoolProfile

Posted by mccabejj <mc...@gmail.com>.
Thanks Claus.  Switching to ThreadPool instead of ThreadPoolProfile worked.  

Another quick (hopefully) question on Thread Pools in Camel.  I think I've
observed that there are multiple ThreadPoolExecutor's created for each
route.  It seems to be 1 for every WireTap present on the route.  So if I
have 3 routes with 3 wiretaps each then there are 9 ThreadPoolExecutor
instances each with N number of available threads based on the profile.

Is this expected?  If so, I guess this is ok...?

I think this was noted by someone else in the following post:
http://camel.465427.n5.nabble.com/WireTap-threads-number-keeps-on-growing-td5557827.html
/"I now understand that each route has its own pool. So I have (10 *
#schedules) threads of wiretap."/

Thanks again for the great community support.

JM

--
View this message in context: http://camel.465427.n5.nabble.com/WireTap-Defining-custom-ThreadPoolProfile-tp5645423p5646502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: WireTap - Defining custom ThreadPoolProfile

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Apr 17, 2012 at 4:20 AM, mccabejj <mc...@gmail.com> wrote:
> Hello,
>
> Camel Version: 2.8.2
>
> I am trying to setup a custom ThreadPoolProfile (Spring DSL) for the WireTap
> calls in our routes.  Based on the
> http://camel.apache.org/threading-model.html Threading Model Documentation
> it should look something like this:
>
> <threadPoolProfile id="customThreadPoolProfile" poolSize="10"
> maxPoolSize="20" maxQueueSize="-1"/>
>
> And then the WireTap on the route should look something like this:
> <wireTap uri="direct:gateway/services/LogRequestDesktop"
> executorServiceRef="customThreadPoolProfile"/>
>
> However, when I define it this way in the CamelContext and fire it up, Camel
> is unable to load the route due to the inability to find a threadPoolProfile
> with the defined id.  If I inspect/debug the running CamelContext I do not
> see the custom threadPoolProfile reference.
>
> If I change it to the following then Camel finds the threadPoolProfile and
> it works.  However, this isn't really what I want since I'd like for the
> custom profile to only apply for the WireTaps.
>
> <threadPoolProfile id="customThreadPoolProfile" poolSize="10"
> maxPoolSize="20" maxQueueSize="-1" defaultProfile="true"/>
>
> What am I doing wrong?  Thanks in advance.
>

I think there was a bug in that Camel release. You may try a newer release.

Or alternatively try with a <threadPool> instead of a
<threadPoolProfile> and assign that to the wire tap.
I think the bug was about failing to discover profiles.



> JM
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/WireTap-Defining-custom-ThreadPoolProfile-tp5645423p5645423.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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/