Name

Aggregate — Aggregates many messages into a single message

Usage

The Aggregate pattern uses an expression to determine which messages to aggregate into a single message. Messages that match the expression are held until they combined by the specified aggregation strategy bean.

The Aggregate pattern can be placed anywhere in the body of a route.

Properties

Table 10 describes the properties you can specify using the properties editor.

Table 10. Aggregate Properties

NameDescription
Correlation ExpressionSpecifies the expression used to correlate the messages that are aggregated.
languageSpecifies the expression language used to process the correlation expression.
Completion Size ExpressionSpecifies an expression used to determine when aggregation is complete based on the number of exchanges processed.
languageSpecifies the expression language used to process the completion size expression.
Completion PredicateSpecifies the expression used to determine when the aggregated message is complete based on it's contents.
languageSpecifies the expression language used to process the completion predicate expression.
Completion Timeout ExpressionSpecifies an expression used to determine when aggregation is complete based on the amount of time, in milliseconds, the aggregator has been inactive.
languageSpecifies the expression language used to process the completion timeout expression.
Strategy RefSpecifies a reference for looking up the AggregationStrategy in the registry.
Close Correlation Key On CompletionSpecifies the number of closed correlation keys stored in the cache used to determine if an exchange should be accepted.
Completion TimeoutSpecifies the amount of time, in milliseconds, the aggregator must be inactive to complete an aggregated message. The property cannot be used with Completion Interval.
Timeout Checker Executor Service RefSpecifies a reference for looking up the timeoutExecutorService to use for custom thread pool management when using one of the options: Completion Timeout, Completion Timeout Expression, or Completion Interval.
Executor Service RefSpecifies a reference for looking up the executorService to use for thread pool management when using the Parallel Processing option or when sending out aggregated exchanges.
Force Completion On StopSpecifies whether to complete all aggregated exchanges currently in route when the routing context is stopped. The default is Disabled.
Completion IntervalSpecifies an interval of time, in milliseconds, after which the aggregator completes any in process aggregate messages. This property cannot be used with Completion Timeout.
Ignore Invalid Correlation KeysSpecifies whether the aggregator ignores invalid correlation keys. The default is Disabled, which causes the aggregator to throw an exception when it encounters an invalid correlation key.
Aggregation Repository RefSpecifies a reference for looking up a custom AggregationRepository in the registry. The AggregationRepository stores the messages while they are being aggregated (held).
Discard On Completion TimeoutSpecifies whether aggregates that are completed due to a timeout, in milliseconds, are discarded. The default is Disabled.
Inherit Error HandlerSpecifies whether the node should use the error handler configured for the route. The default is Disabled.
Completion From Batch ConsumerSpecifies whether aggregates can be completed based on information from a batch consumer. The default is Disabled.
Completion SizeSpecifies the number of exchanges the aggregator processes before marking the aggregated message complete.
Eager Check Completion

Specifies whether the aggregator determines completion by eagerly checking the data as exchanges are received or by checking the data after it's been aggregated into a single exchange. The default is Disabled.

This property works in conjunction with and influences the behavior of the Completion Predicate property.

Group ExchangesSpecifies whether the aggregator groups all outgoing exchanges into a single GroupedExchange object. The default is Disabled.
Parallel ProcessingSpecifies whether the aggregator processes multiple messages concurrently. The default is Disabled.
IdSpecifies a unique identifier for the endpoint. The Id can be used to refer to the endpoint in the Camel XML file.
DescriptionSpecifies a text description for the node. This description is included in the generated XML file, but it is informational only. It is not used by Apache Camel.

Related topics

Expression and Predicates Languages
Configuring the route editor