You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache Camel 3.11+拆分聚合引发路由执行顺序异常求助

Camel 3.11+ 版本路由串行执行异常问题

无法访问Camel官方问题跟踪系统,在此求助。

当前正在从Camel 3.7.3逐步升级至新版本,测试发现:

  • 升级到3.11.7后出现执行顺序异常
  • 3.20.1版本中问题仍存在
  • 3.10版本表现正常,结合3.11版本Aggregate EIP的变更记录,几乎可以确定是该版本的变更引入了此bug

问题详情

使用以下管道配置时,理论上SPLIT_WORKER_ROUTE_ID与OTHER_ROUTE_ID应按顺序串行执行:

.to(SPLIT_WORKER_ROUTE_ID, OTHER_ROUTE_ID)

但当SPLIT_WORKER_ROUTE_ID内部包含如下split+聚合逻辑时:

.split(body())
     .process(splitWorkerProcessor)
.aggregate(exchangeProperty(CORRELATION_ID), new SplitAggregator()).completionSize(exchangeProperty(SPLIT_SIZE))
.to(AFTER_SPLIT_ROUTE_ID)

OTHER_ROUTE_ID会在SPLIT_WORKER_ROUTE_ID尚未执行完AFTER_SPLIT_ROUTE_ID时提前启动,两者并行运行,导致执行顺序混乱。

若改为以下写法(或回退到3.7.3版本),路由会按预期串行执行,但这种方式无法满足复杂聚合条件的需求:

.split(body(), new SplitAggregator()).parallelProcessing()
.process(splitWorkerProcessor)
.end()
.to(AFTER_SPLIT_ROUTE_ID)

问题日志

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 finished 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

恳请各位提供帮助,非常感谢!

内容的提问来源于stack exchange,提问作者meront

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 13:10:49