You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "meront@o2.pl" <me...@o2.pl> on 2023/02/02 17:55:00 UTC

Camel - Split and aggregation bug

Hello,  I&#39;m migrating gradually to the newest Camel version. Currently I&#39;m going from the 3.7.3 to 3.11.7 but I checked that this bug happens also on 3.19.   Ok, so to the point.  When I have pipeline like this:   .to(SPLIT_WORKER_ROUTE_ID, OTHER_ROUTE_ID)   it should execute in sequence. But when somewhere inside SPLIT_WORKER_ROUTE_ID I have an aggregation code like this:   .split(body())       .process(splitWorkerProcessor)  .aggregate(exchangeProperty(CORRELATION_ID), new SplitAggregator()).completionSize(exchangeProperty(SPLIT_SIZE))  .to(AFTER_SPLIT_ROUTE_ID)   before it goes to AFTER_SPLIT_ROUTE_ID the OTHER_ROUTE_ID kicks in and starts to run in parallel with SPLIT_WORKER_ROUTE_ID.   When I rewrite the code like this (or go back to Camel 3.7.3):   .split(body(), new SplitAggregator()).parallelProcessing()  .process(splitWorkerProcessor)  .end()   everything runs as it should sequentially. Unfortunately, I have to use more complex aggregation conditions so I&#39;m afraid I cannot use this workaround as aggregation configuration is not possible in this approach.   I guess that according to   camel.apache.org https://camel.apache.org/manual/camel-3x-upgrade-guide-3_11.html#_aggregate_eip  something has changed in this area.    The problem leads to the situation that order of execution is disturbed and we have this:  .to(SPLIT_WORKER_ROUTE_ID, OTHER_ROUTE_ID)   the OTHER_ROUTE_ID can complete before this sequence SPLIT_WORKER_ROUTE_ID -&gt; AFTER_SPLIT_ROUTE_ID.   Here is the log presenting the problem: 2023-02-02T18:45:41,229 [main] INFO  direct://Main                  [...] [] []  [] [] - MAIN START  2023-02-02T18:45:41,230 [Camel (camel-1) thread #1 - Threads] INFO  direct://splitWorker           [...] [] []  [] [] - SPLIT_WORKER_ROUTE_ID START  2023-02-02T18:45:41,399 [Camel (camel-1) thread #1 - Threads] INFO  direct://other                 [...] [] []  [] [] - OTHER_ROUTE_ID START  2023-02-02T18:45:41,399 [Camel (camel-1) thread #3 - Aggregator] INFO  direct://splitWorker           [...] [] []  [] [] - Aggregation just finised inside SPLIT_WORKER_ROUTE_ID START!  2023-02-02T18:45:41,399 [Camel (camel-1) thread #3 - Aggregator] INFO  direct://splitWorker           [...] [] []  [] [] - SPLIT_WORKER_ROUTE_ID FINISH  2023-02-02T18:45:41,400 [Camel (camel-1) thread #3 - Aggregator] INFO  direct://afterSplit            [...] [] []  [] [] - AFTER_SPLIT_ROUTE_ID START  2023-02-02T18:45:42,404 [Camel (camel-1) thread #1 - Threads] INFO  direct://other                 [...] [] []  [] [] - OTHER_ROUTE_ID FINISH  2023-02-02T18:45:43,406 [Camel (camel-1) thread #3 - Aggregator] INFO  direct://afterSplit            [...] [] []  [] [] - AFTER_SPLIT_ROUTE_ID FINISH  2023-02-02T18:45:47,417 [Camel (camel-1) thread #6 - Delay] INFO  direct://Main                  [...] [] []  [] [] - MAIN FINISH   I would appreciate any help, thanks a lot!   Jan