org.apache.camel.processor
Class Aggregator

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.BatchProcessor
          extended by org.apache.camel.processor.Aggregator
All Implemented Interfaces:
Navigate<Processor>, Processor, Traceable, Service

public class Aggregator
extends BatchProcessor
implements Traceable

An implementation of the Aggregator pattern where a batch of messages are processed (up to a maximum amount or until some timeout is reached) and messages for the same correlation key are combined together using some kind of AggregationStrategy (by default the latest message is used) to compress many message exchanges into a smaller number of exchanges.

A good example of this is stock market data; you may be receiving 30,000 messages/second and you may want to throttle it right down so that multiple messages for the same stock are combined (or just the latest message is used and older prices are discarded). Another idea is to combine line item messages together into a single invoice message.

Version:
$Revision: 836213 $

Field Summary
 
Fields inherited from class org.apache.camel.processor.BatchProcessor
DEFAULT_BATCH_SIZE, DEFAULT_BATCH_TIMEOUT
 
Constructor Summary
Aggregator(Processor processor, AggregationCollection collection)
           
Aggregator(Processor processor, Expression correlationExpression, AggregationStrategy aggregationStrategy)
           
Aggregator(Processor processor, Expression correlationExpression, AggregationStrategy aggregationStrategy, Predicate aggregationCompletedPredicate)
           
 
Method Summary
 String getTraceLabel()
          Gets the trace label used for logging when tracing is enabled.
 String toString()
           
 
Methods inherited from class org.apache.camel.processor.BatchProcessor
doStart, doStop, getBatchSize, getBatchTimeout, getExceptionHandler, getOutBatchSize, getProcessor, hasNext, isBatchConsumer, isGroupExchanges, next, process, processExchange, setBatchConsumer, setBatchSize, setBatchTimeout, setExceptionHandler, setGroupExchanges, setOutBatchSize
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Aggregator

public Aggregator(Processor processor,
                  Expression correlationExpression,
                  AggregationStrategy aggregationStrategy)

Aggregator

public Aggregator(Processor processor,
                  Expression correlationExpression,
                  AggregationStrategy aggregationStrategy,
                  Predicate aggregationCompletedPredicate)

Aggregator

public Aggregator(Processor processor,
                  AggregationCollection collection)
Method Detail

toString

public String toString()
Overrides:
toString in class BatchProcessor

getTraceLabel

public String getTraceLabel()
Description copied from interface: Traceable
Gets the trace label used for logging when tracing is enabled.

The label should be short and precise.

Specified by:
getTraceLabel in interface Traceable
Returns:
the label


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.