Thanks for a quick reply, it clarified things a bit, but some questions remain : Does the concurrentConsumers setting do anything for me throughput-wise in the route I posted ? I am not sure whether to include it or not, given that the next step is an aggregator ?
(The route I posted was just an example, IRL I have both a timeout and a timeout completion) If I go for the multiple-bean-instance solution (as opposed to an aggregator), how do I control the number of bean instances ? -- jo Den 16. des. 2011 kl. 11:55 skrev Claus Ibsen: > Hi > > On Fri, Dec 16, 2011 at 11:38 AM, Jan Olav Eide <[email protected]> wrote: >> Hello, I am pretty new to Camel (but an old Mule-hand), so I hope anyone can >> help me on this. >> > > Welcome to the community. Just great having people with mixed experience. > >> I require a route that does the following : >> >> *Consume messages from Active MQ >> *Aggregate these messages according to a strategy. >> *Send these aggregates to a component for further processing. >> >> Now, I require as much as this as possible to happen in parallell. That is : >> message consumption from the queue, aggregation and further processing. The >> aggregator is very flexible, so ordering of messages is not an issue here, >> it aggregates whatever it gets. >> >> I have read something about an aggregator being a singleton, so that also >> confuses me a bit. >> >> Does the route below sound reasonable ? I am a little confused about the >> interplay with concurrentConsumers and parallellProcessing, but I guess the >> first makes sure that there are a number of threads consuming the messages, >> and the second controls the aggregation ? Do I need one or two >> paralleProcessing() calls in the route below ? My current interpretation is >> that the first controls the aggregation and the second the >> "furtherProcessing", is that correct ? >> >> >> >> from("jms:queue:jalla?concurrentConsumers=12&maxConcurrentConsumers=50").aggregate(constant(true),new >> ArrayListAggregationStrategy()).completionSize(3).parallelProcessing() >> .to("furtherProcessing").parallelProcessing(); > > > Yeah you only need 1 parallel processing, to enable this on the aggregator. > This tells the aggregate to process the outgoing messages in parallel. > > You can refer to a executorService instead of parallel processing to > control the pool size etc. > More details here > http://camel.apache.org/threading-model.html > > As parallel processing will use the default setting (the setting from > the default thread pool profile). > You can read about that from the link above. > > > In the example above you will aggregate 3 messages together. > However you do not have any timeout completion, which mean, that for > example if there stops being messages on the JMS queue, > you can have partially aggregated messages stuck in the aggregator. > > The aggregator will have parts of the logic executed synchronized, to > guard against thread safety issues in the aggregation process. > So if this becomes a bottleneck for you. You can simple just implement > a bean, where you aggregate 3 messages yourself, and then send a > message > to a Camel endpoint using a producer template etc. Then you can have > multiple bean instances, each aggregating 3 messages. All running in > parallel. > > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/
