When aggregation Exchanges at some point you need to indicate that the aggregated exchanges is complete, so they can be send out of the aggregator. Camel allows you to indicate completion in various ways as follows:
completionTimeout - Is an inactivity timeout in which is triggered if no new exchanges have been aggregated for that particular correlation key within the period.
completionInterval - Once every X period all the current aggregated exchanges are completed.
completionSize - Is a number indicating that after X aggregated exchanges it's complete.
completionPredicate - Runs a Predicate when a new exchange is aggregated to determine if we are complete or not
completionFromBatchConsumer - Special option for Batch Consumer which allows you to complete when all the messages from the batch has been aggregated. |
forceCompletionOnStop - Indicates to complete all current aggregated exchanges when the context is stopped.
Notice that all the completion ways are per correlation key. And you can combine them in any way you like. It's basically the first which triggers that wins. So you can use a completion size together with a completion timeout. Only completionTimeout and completionInterval cannot be used at the same time.
Notice the completion is a mandatory option and must be provided to the aggregator. If not provided Camel will throw an Exception on startup.