camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Jancke" <>
Subject Last Aggregated Exchange lost - Aggregator with a Batch-Consumer and persistent AggregationRepository
Date Tue, 18 Jan 2011 14:12:53 GMT
Hello Camel-People,

I've noticed a problem of "loosing last aggregated exchange", when using a certain combination
of Camel components. I've got a testcase attached to reproduce the problem.

Camel Version: 2.5.0
Components: "any batch-consumer", aggregator, (hawtdb | jdbc)-aggregation-repository

What I'm doing: 
Consume from Jpa (or other batching consumer), aggregate the whole batch ".completionFromBatchConsumer()"
using a non-trivial / persistent AggregationRepository and then doing further processing.

A persistent AggregationRepository for production, like HawtDBAggregationRepository, JdbcAggregationRepository
or my custom JpaAggregationRepository, are essential part of the problem. All of them serialize
exchanges, thus "get" on the repository returns new object instances in opposite to the MemoryAggregationRepository.

The Problem:
The contents of the last aggregated Exchange is lost during onCompletion of the AggregateProcessor.

In AggregateProcessor.onAggregation(...) there is a special "path" when completing from a
batch consumer. This one does not use the current aggregated exchange, but reads the last
one from the AggregationRepository and uses it for further processing in onCompletion...(...)

Use ".completionPredicate(property(Exchange.BATCH_COMPLETE).isEqualTo(true))" instead of ".completionFromBatchConsumer()".
In this case, the sepcial "path" (see above) is not entered, and the current aggregated exchange
is used for completion of the aggregate.

Sebastian Jancke

PS: Seems like a was to fast sending this mail before - having not confirmed my maillinglist-subscription.
Hopefully no duplicates...
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren:

View raw message