The thread pool must be a scheduled thread pool and not a regular pool On Fri, Apr 21, 2017 at 3:50 PM, Robson Vargas Farias <[email protected]> wrote: > Hi Claus, thanks for the support. So, actually as I mentioned, my query is: > "Why the throttle works only with ThreadPoolProfile and not with a > ThreadPool", in your sample, you used a threadpoolprofile and it´s fine, it > works for me too. But, try to run that test with a threadpool: > > <?xml version="1.0" encoding="UTF-8"?> > <!-- Licensed to the Apache Software Foundation (ASF) under one or more > contributor > license agreements. See the NOTICE file distributed with this work for > additional > information regarding copyright ownership. The ASF licenses this file to > You under the Apache License, Version 2.0 (the "License"); you may not use > this file except in compliance with the License. You may obtain a copy of > the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required > by applicable law or agreed to in writing, software distributed under the > License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR > CONDITIONS > OF ANY KIND, either express or implied. See the License for the specific > language governing permissions and limitations under the License. --> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > "> > > <camelContext xmlns="http://camel.apache.org/schema/spring"> > > <threadPool id="my_thread_pool" poolSize="1" maxPoolSize="4" > maxQueueSize="100" threadName="my_thread_pool" keepAliveTime="0" > rejectedPolicy="DiscardOldest" timeUnit="SECONDS" /> > > <route> > <from uri="direct:start" /> > <throttle executorServiceRef="my_thread_pool"> > <constant>2</constant> > <to uri="mock:result" /> > </throttle> > </route> > > </camelContext> > > </beans> > > > 2017-04-21 5:53 GMT-03:00 Claus Ibsen <[email protected]>: > >> I created an unit test that cannot reproduce the problem you have >> https://github.com/apache/camel/commit/9b3e7ebe58ae3e569d3869c4766429 >> 37c09d0a0c >> >> On Fri, Apr 21, 2017 at 10:36 AM, Claus Ibsen <[email protected]> >> wrote: >> > It ought to work as its using the same code the other EIPs would do, >> > can you provide a very small sample project that reproduces this. >> > >> > >> > >> > >> > On Thu, Apr 20, 2017 at 9:09 PM, Robson Vargas Farias >> > <[email protected]> wrote: >> >> I've updated to the latest camel-x version which is 2.18.3 and the error >> >> still persists. >> >> >> >> Should the threadPool be declared in other place than into the >> camelContext >> >> ? >> >> >> >> "..because of ExecutorServiceRef my_thread_pool not found in registry >> or as >> >> a thread pool profile." >> >> >> >> 2017-04-20 10:44 GMT-03:00 Claus Ibsen <[email protected]>: >> >> >> >>> That is very old, its likely/possible fixed on newer version. So I >> >>> suggest to try upgrading or build a new sample project using latest >> >>> release and see if it works there. >> >>> >> >>> Knowing something is still not working in latest release brings >> >>> attention to us. Otherwise we dont have the time to look into this >> >>> ourselves first when users are using very old versions of Camel. >> >>> >> >>> On Thu, Apr 20, 2017 at 3:37 PM, Robson Vargas Farias >> >>> <[email protected]> wrote: >> >>> > Hi Claus, currently using 2.13.2 - and no, did not try other version. >> >>> > >> >>> > 2017-04-20 10:33 GMT-03:00 Claus Ibsen <[email protected]>: >> >>> > >> >>> >> What version of Camel do you use, and have you tried with a newer >> >>> version >> >>> >> >> >>> >> On Thu, Apr 20, 2017 at 3:29 PM, Robson Vargas Farias >> >>> >> <[email protected]> wrote: >> >>> >> > Hi, >> >>> >> > >> >>> >> > Can you help me where is my miss? >> >>> >> > >> >>> >> > I've a camel context configured with a route containing a throttle >> >>> which >> >>> >> is >> >>> >> > pointing (ref) to a threadPool: >> >>> >> > >> >>> >> > <camel:camelContext id="camel-server" useMDCLogging="true" >> >>> >> > allowUseOriginalMessage="false"> >> >>> >> > >> >>> >> > >> >>> >> > <!-- thread pools --> >> >>> >> > >> >>> >> > <camel:threadPool id="my_thread_pool" >> >>> >> > poolSize="1" >> >>> >> > maxPoolSize="4" >> >>> >> > maxQueueSize="100" >> >>> >> > threadName="my_thread_pool" keepAliveTime="0" >> >>> >> > rejectedPolicy="DiscardOldest" timeUnit="SECONDS" /> >> >>> >> > >> >>> >> > .. >> >>> >> > >> >>> >> > >> >>> >> > <camel:route id="my_route"> >> >>> >> > <camel:from ref="mq_endpoint" /> >> >>> >> > <camel:throttle timePeriodMillis="1000" >> executorServiceRef="my_thread_ >> >>> >> pool"> >> >>> >> > .. >> >>> >> > >> >>> >> > >> >>> >> > but, when I start my application I got below error: >> >>> >> > >> >>> >> > Caused By: java.lang.IllegalArgumentException: ExecutorServiceRef >> >>> >> > my_thread_pool not found in registry or as a thread pool profile. >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > If I change the throttle from a threadPool to a threadPoolProfile >> it >> >>> >> works. >> >>> >> > So, why it is not working with a threadPool? >> >>> >> > >> >>> >> > Thanks. >> >>> >> >> >>> >> >> >>> >> >> >>> >> -- >> >>> >> Claus Ibsen >> >>> >> ----------------- >> >>> >> http://davsclaus.com @davsclaus >> >>> >> Camel in Action 2: https://www.manning.com/ibsen2 >> >>> >> >> >>> >> >>> >> >>> >> >>> -- >> >>> Claus Ibsen >> >>> ----------------- >> >>> http://davsclaus.com @davsclaus >> >>> Camel in Action 2: https://www.manning.com/ibsen2 >> >>> >> > >> > >> > >> > -- >> > Claus Ibsen >> > ----------------- >> > http://davsclaus.com @davsclaus >> > Camel in Action 2: https://www.manning.com/ibsen2 >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 >>
-- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
