Hello,
In my application I have a route with an aggregation using an aggregation
repository ClusteredJdbcAggregationRepository and completionTimeout. This route
is part of a micro service that can be scaled. From time to time, the micro
service does not start due to a NPE:
Caused by: java.lang.NullPointerException: Cannot invoke
"org.apache.camel.Exchange.getProperty(org.apache.camel.ExchangePropertyKey,
Object, java.lang.Class)" because "exchange" is null
at
org.apache.camel.processor.aggregate.AggregateProcessor.restoreTimeoutMapFromAggregationRepository(AggregateProcessor.java:920)
~[camel-core-processor-3.20.1.jar:3.20.1]
Looking at the code in
https://github.com/apache/camel/blob/camel-3.20.1/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java#L920
In my case the exchange is null because it has already been processed by one of
the micro service instance.
for (String key : keys) {
Exchange exchange = aggregationRepository.get(camelContext, key);
// grab the timeout value
long timeout = exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT,
0L, long.class);
Is my assumption correct?
Sydney