Hi

Yes that sounds plausible. So it would be good in the camel code, to check
for null exchange

On Sat, Feb 18, 2023 at 6:46 PM Sydney Henrard <shenr...@smartwavesa.com>
wrote:

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

-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to