...
Option | Default | Description |
---|---|---|
batchSize | 100 | The in batch size. This is the number of incoming exchanges that is processed by the aggregator and when this threshold is reached the batch is completed and send. |
outBatchSize | 0 | Available as of Camel 1.5. The out batch size. This is the number of exchanges currently aggregated in the |
batchTimeout | 1000L | Timeout in millis. How long should the aggregator wait before its completed and sends whatever it has currently aggregated. |
groupExchanges | false | Camel 2.-0: If enabled then Camel will group all aggregated Exchanges into a single combined |
AggregationCollection and AggregationStrategy
...
Code Block |
---|
<aggregator batchTimeout="500" collectionRef="aggregatorCollection"> <expression/> <to uri="mock:result"/> </aggregator> |
Using Grouped Exchanges
Available as of Camel 2.0
You can enable grouped exchanges to combine all aggregated exchanges into a single org.apache.camel.impl.GroupedExchange
holder class that contains all the individual aggregated exchanges. This allows you to process a single Exchange containing all the aggregated exchange. Lets start with how to configure this in the router:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateGroupedExchangeTest.java} |
And the next part is part of an unit code that demonstrates this feature as we send in 5 exchanges each with a different value in the body.
And we will only get 1 exchange out of the aggregator, but we can access all the individual aggregated exchanges using the GroupedExchange#get
method.
Wiki Markup |
---|
{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateGroupedExchangeTest.java} |
Include Page | ||||
---|---|---|---|---|
|
...