org.apache.camel.builder
Class AggregatorBuilder

java.lang.Object
  extended by org.apache.camel.builder.BuilderSupport
      extended by org.apache.camel.builder.FromBuilder
          extended by org.apache.camel.builder.AggregatorBuilder
All Implemented Interfaces:
ProcessorFactory

public class AggregatorBuilder
extends FromBuilder

A builder for 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 {@link 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: 1.1 $

Field Summary
 
Fields inherited from class org.apache.camel.builder.FromBuilder
DEFAULT_TRACE_CATEGORY
 
Constructor Summary
AggregatorBuilder(FromBuilder builder, Expression correlationExpression)
           
 
Method Summary
 AggregatorBuilder aggregationStrategy(AggregationStrategy aggregationStrategy)
           
 AggregatorBuilder batchSize(int batchSize)
           
 AggregatorBuilder batchTimeout(int batchTimeout)
           
 Route createRoute()
           
 AggregationStrategy getAggregationStrategy()
           
 int getBatchSize()
           
 long getBatchTimeout()
           
 void setAggregationStrategy(AggregationStrategy aggregationStrategy)
           
 void setBatchSize(int batchSize)
           
 void setBatchTimeout(long batchTimeout)
           
 
Methods inherited from class org.apache.camel.builder.FromBuilder
addProcessBuilder, addProcessor, addProcessorBuilder, aggregator, aggregator, choice, convertBodyTo, convertOutBodyTo, createProcessor, delayer, delayer, delayer, errorHandler, filter, getBuilder, getFrom, getProcessors, getRouteBuilder, idempotentConsumer, inheritErrorHandler, intercept, intercept, makeProcessor, pipeline, pipeline, pipeline, policies, policy, process, recipientList, resequencer, resequencer, resequencer, setBody, setHeader, setOutBody, setOutHeader, setProperty, setRouteBuilder, splitter, throttler, to, to, to, to, to, trace, trace, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.builder.BuilderSupport
body, bodyAs, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, deadLetterChannel, endpoint, endpoints, endpoints, getContext, getErrorHandlerBuilder, header, isInheritErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, noErrorHandler, outBody, outBody, setContext, setErrorHandlerBuilder, setInheritErrorHandler, systemProperty, systemProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregatorBuilder

public AggregatorBuilder(FromBuilder builder,
                         Expression correlationExpression)
Method Detail

createRoute

public Route createRoute()
                  throws Exception
Overrides:
createRoute in class FromBuilder
Throws:
Exception

aggregationStrategy

public AggregatorBuilder aggregationStrategy(AggregationStrategy aggregationStrategy)

batchSize

public AggregatorBuilder batchSize(int batchSize)

batchTimeout

public AggregatorBuilder batchTimeout(int batchTimeout)

getAggregationStrategy

public AggregationStrategy getAggregationStrategy()

setAggregationStrategy

public void setAggregationStrategy(AggregationStrategy aggregationStrategy)

getBatchSize

public int getBatchSize()

setBatchSize

public void setBatchSize(int batchSize)

getBatchTimeout

public long getBatchTimeout()

setBatchTimeout

public void setBatchTimeout(long batchTimeout)


Copyright © 2007 Apache Software Foundation. All Rights Reserved.