CamelExchangeException交换标头上的无效关联密钥

时间:2018-10-17 14:31:37

标签: apache-camel aggregate correlation

当尝试从我的AWS SQS队列中聚合消息时,Apache Camel抛出Invalid Correlation Key异常。 消息使用ZipSplitter放置在队列中,并且所有消息都以匹配的“ parentId”值出现在队列中(我使用随机uuid作为拆分的一部分添加了该值-我也尝试过CamelSourceFile)。我反复收到异常,直到重试用尽。

我的聚合表达式:

from(--queue--).aggregate(header("parentId"), customAggregationStrategy).completionTimeout(3000).processor(new Processor() {...}.to(--next queue--);

我的customAggregationStrategy或任何后续处理器均未发出日志。它无法聚合:

... DeadLetterChannel - Failed delivery for (MessageId: ...). On Delivery attempt: 0 caught ...CamelExchangeException: Invalid correlation key. Exchange[ID...]

重试尝试的传递尝试是0到9。

令人发指的是,该代码在任何地方都可以运行,但可以在本地运行……您认为这会缩小范围,但是无论是异常还是其他记录都无法说明这里发生的事情。

1 个答案:

答案 0 :(得分:1)

表达相关密钥时,您可以尝试使用Camel简单语言,即:

.aggregate(simple("${headers.parentId}", customAggregationStrategy)

这样,可能会被默默忽略吗?

您是否激活了骆驼追踪器(http://camel.apache.org/tracer.html)来分析您的交流并简化调试?

我怀疑您有一个没有“ parentId”标头的Exchange。如果要跳过它们,只需激活ignoreInvalidCorrelationKeys选项(请参阅http://camel.apache.org/aggregator2.html