Aggregating with intervals

Aggregation according to size or predicate as described in the Aggregating related messages recipe is an excellent foundation for batching messages together. This recipe will describe how to use intervals to release an aggregated message per specified period.

Getting ready

The Java code for this recipe is located in the org.camelcookbook.splitjoin.aggregateinterval package. The Spring XML example is located in src/main/resources/META-INF/spring/aggregateCompletionInterval-context.xml.

How to do it...

Inside your Aggregator definition, define a completionInterval attribute containing a period in milliseconds. The attribute can be used as the sole aggregation condition, or in combination with others.

In the XML DSL, this is ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.