Using a standalone aggregator as you've configured will result in the
aggregations completing in a separate thread with the side effect that the
aggregated exchange is completely disconnected from the split.

And you're correct that if you use the splitter's aggregation slot that you
don't get to provide completion parameters. That's because the aggregation
is complete when there are no more items to split.

Using your standalone aggregator, you can try populating the aggregator's
executorService option with a SynchronousExecutorService. This will result
in aggregations completing on the same thread as the splitter. But I'm not
sure if that means that exceptions in the aggregator bubble up to the
splitter. You'll have to test this.


On Tue, Jan 30, 2024 at 11:24 AM Aditya Kavathekar <
[email protected]> wrote:

> Hello community,
> I am using camel 3.20.5 in XML DSL.
> I am trying to achieve batch processing and below is my source code.
>
> <split stopOnException="true" >
> <aggregate aggregationStrategy="GroupedBodyAggregationStartegy"
> completionSize= 500 completionTimeout= 1000>
> //Some code
> //Exception occurs here
> </aggregate>
> </split>
>
> OnException block here
>
> Now here I want to stop the aggregation incase any exception occurs inside
> it but the aggregator just executes the code from onException block and
> continues its execution. Please suggest a way to stop aggregation incase of
> exception.
>
> Alternatively if I add the aggregation strategy to the split then It stops
> on exception but I am not able to provide completionSize or
> completionTimeout options in split. Please suggest if I am missing
> something here.
>
> Thanks,
> Aditya
>

Reply via email to