'Parallel in Apache Camel Aggregator

I have a Camel route configuration like below:

from("seda:logCall?concurrentConsumers=50")
                    .aggregate(header("EXCHANGE_ID"), new CustomAggregator())
                    .completionSize(2)
                    .parallelProcessing()
                    .to("bean:someAdapter?method=someMethod");

What I want to achieve is parallel processing all the way down means messages should be processed in parallel by aggregator and bean (after aggregation). However, when I was debugging I saw that aggregate blocks (run in a single thread). Bean processes messages in parallel so it is ok.

How should I configure aggregator to aggregate incoming messages in parallel?



Solution 1:[1]

You could try

from("seda:logCall?concurrentConsumers=50") .threads().executorService(Executors.newCachedThreadPool()) .aggregate(header("EXCHANGE_ID"), new CustomAggregator()) .completionSize(2) .parallelProcessing() .to("bean:someAdapter?method=someMethod");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mab