I have a route where I want Camel to visit the following beans:
- First,
loggingBean
- Second, an
aggregator
that waits for a certain number of messages to aggregate on it - Once the Aggregator's
completionSize
is reached (3), keep going to #4 - Third,
processorBean
- And fourth/last,
finalizerBean
Here is my route:
<route id="my-camel-route">
<from uri="direct:starter" />
<to uri="bean:loggingBean?method=shutdown" />
<aggregate strategyRef="myAggregationStrategy" completionSize="3">
<correlationExpression>
<simple>${header.id} == 1</simple>
</correlationExpression>
<to uri="bean:processorBean?method=process" />
</aggregate>
<to uri="bean:finalizerBean?method=shutdown" />
</route>
My question: do I need to place finalizerBean
inside the <aggregate>
element like so:
<aggregate strategyRef="myAggregationStrategy" completionSize="3">
<correlationExpression>
<simple>${header.id} == 1</simple>
</correlationExpression>
<to uri="bean:processorBean?method=process" />
<to uri="bean:finalizerBean?method=shutdown" />
</aggregate>
Basically, I'm wondering if the way I currently have things will prompt Camel to send the message to the aggregator, and then also send it on to finalizerBean
(essentially, bypassing the aggregator). In my case, I want it to aggregate until completionSize
is 3, and then send the aggregated exchange on to the processorBean
and then finally finalizerBean
.
Or have I configured this correctly? What's the difference between finalizerBean
being inside the <aggregate>
element vs being outside it?