Hi See this unit test http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentTest.java?annotate=794648&pathrev=794648
Where I pass is my own executor server to a producer template so I can run with the number of concurrent producers as I want. On Thu, Jul 16, 2009 at 12:20 PM, Claus Ibsen<[email protected]> wrote: > Hi > > The reason why you get at most 5 is that you are using the > asyncRequestBody that uses a thread pool with a default size of 5. > This is going to be improved in Camel 2.1 where you can configure > thread pools much more easily with Camel. > > You can create you own producer template and pass in the executor > service you can define with a higher thread pool and type of choice > public DefaultProducerTemplate(CamelContext context, > ExecutorService executor) { > > > > On Thu, Jul 16, 2009 at 11:52 AM, Claus Ibsen<[email protected]> wrote: >> Hi >> >> Why are you using asyncRequesyBody()? >> >> Its for request/reply messaging and are you really doing that? Do you >> expect a reply? >> >> A simple route like this >> >> from("seda:foo?concurrentConsumers=10").to("mock:before").delay(2000).to("mock:result"); >> >> Works fine with 10 concurrent and all will be done in about 2 sec time. >> >> >> >> On Tue, Jul 14, 2009 at 3:57 AM, Ole Jørgensen<[email protected]> wrote: >>> >>> Concurrentconsumers not concurrent >>> >>> I made a test with concurrentconsumers. Problem is that I can get max 5 >>> realy concurrent threads. I log the id and name of the treads and it seems, >>> that camel indeed is making the right number of threads but only 5 is realy >>> working concurrent. >>> I put 25 messages on a seda queue and specify concurrentconsumers. My >>> consumer works for 2 seconds on each message. Concurrentconsumers works as >>> expected for 1-5 cunsumers, but specifying more than 5 concurrentconsumers >>> does not make more consumers work concurrent - max 5. I would expect all 25 >>> messages to be consumed and handled in 2 seconds with 25 concurrentconsumers >>> or more. If I split the messages on 2 different queues I still get max 5 >>> realy concurrentconsumers. >>> Same story when I use activemq. >>> >>> What am I doing wrong ? >>> >>> >>> ------------------------- >>> <camel:camelContext id="camelContext"> >>> <camel:endpoint id="site0" >>> uri="activemq:site0?concurrentConsumers=10"/> >>> <camel:endpoint id="site1" >>> uri="activemq:site1?concurrentConsumers=10"/> >>> </camel:camelContext> >>> >>> <bean id="siteHandler0" class="SiteHandler"/> >>> <bean id="siteHandler1" class="SiteHandler"/> >>> >>> ------------------------ >>> >>> public class CamelRoutes extends RouteBuilder { >>> �...@override >>> public void configure() throws Exception { >>> from("sites").to("bean:split"); >>> from("site0").to("bean:siteHandler0"); >>> from("site1").to("bean:siteHandler1"); >>> } >>> } >>> --------------- >>> >>> public Map onCheese(Map<String, Object> input) { >>> >>> Map<String, Object> res = new HashMap<String, Object>(); >>> >>> Future[] futures = new Future[25]; >>> for (int i = 0; i < futures.length; i++) { >>> Map<String, Object> newInput = new HashMap<String, Object>(); >>> newInput.putAll(input); >>> newInput.put("i", i); >>> futures[i] = producerTemplate.asyncRequestBody("site" + (i % 2), >>> newInput); >>> System.out.println("send = " + i); >>> } >>> System.out.println("------------------ Checking futures >>> ------------------------"); >>> for (int i = 0; i < futures.length; i++) { >>> Future future = futures[i]; >>> Map reply = producerTemplate.extractFutureBody(future, Map.class); >>> res.putAll(reply); >>> } >>> return res; >>> } >>> >>> ----------------------- >>> >>> public class SiteHandler { >>> public Map onSite(Map<String, Object> input) { >>> System.out.println("siteHandler: " + input.get("i")); >>> >>> long start = System.currentTimeMillis(); >>> while (System.currentTimeMillis() < start + 2000); >>> >>> Map<String, Object> res = new HashMap<String, Object>(); >>> res.putAll(input); >>> res.put(this.hashCode() + "", input.get("i")); >>> res.put(Thread.currentThread().getId() + ": " + >>> Thread.currentThread().getName(), input.get("i")); >>> >>> return res; >>> } >>> } >>> --------------------- >>> -- >>> View this message in context: >>> http://www.nabble.com/Concurrentconsumers-not-concurrent-tp24472473p24472473.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
