skanso
skanso

Reputation: 25

Apache Camel - Split, Tokenize and Aggregate not completing when using exchange-factory pooled

I'm having an issue with an Apache Camel route after migrating to version 4.6.0. The problem is that the exchange is never set to done when exchange-factory is pooled instead of default value prototype, and the SPLIT_COMPLETE property always remains false. This causes the aggregation to never complete.

Here's my route definition:

from(direct("input"))
 .routeId("input-route")
 .setHeader(HttpHeaders.CONTENT_TYPE, constant(MediaType.MULTIPART_FORM_DATA_VALUE))
 .unmarshal().mimeMultipart()
 .split().tokenize("\n").streaming()
 .aggregate(constant(true), new GroupedBodyAggregationStrategy())
 .completionSize(1000)
 .completionPredicate(exchangeProperty(Exchange.SPLIT_COMPLETE))
 .setExchangePattern(ExchangePattern.InOnly)
 .multicast().parallelProcessing()
 .to(direct("output"));

Expected behavior:

Using exchange-factory is pooled, the aggregator should complete when either the batch size is reached or when the SPLIT_COMPLETE property is set to true. The exchange should be marked as done after processing.

Actual behavior:

The SPLIT_COMPLETE property is always false. The exchange is never set to done. The aggregation never completes. The MulticastProcessor.MulticastTask#iterator keeps growing, finishes leading to OOM.

This issue started occurring after migrating to Apache Camel 4.6.0. Has anyone encountered a similar problem or know what might be causing this behavior? Any help or suggestions would be greatly appreciated. Thank you!

Upvotes: 0

Views: 127

Answers (0)

Related Questions