org.apache.camel.model
Class AggregateDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition
      extended by org.apache.camel.model.ProcessorDefinition<AggregateDefinition>
          extended by org.apache.camel.model.AggregateDefinition
All Implemented Interfaces:
ExecutorServiceAware, Block, ExecutorServiceAwareDefinition<AggregateDefinition>

public class AggregateDefinition
extends ProcessorDefinition<AggregateDefinition>
implements ExecutorServiceAwareDefinition<AggregateDefinition>

Represents an XML <aggregate/> element

Version:
$Revision: 22100 $

Field Summary
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
errorHandlerBuilder, errorHandlerRef, inheritErrorHandler, log
 
Constructor Summary
AggregateDefinition()
           
AggregateDefinition(Expression correlationExpression)
           
AggregateDefinition(Expression correlationExpression, AggregationStrategy aggregationStrategy)
           
AggregateDefinition(ExpressionDefinition correlationExpression)
           
AggregateDefinition(Predicate predicate)
           
 
Method Summary
 AggregateDefinition aggregationRepository(AggregationRepository aggregationRepository)
          Sets the custom aggregate repository to use.
 AggregateDefinition aggregationRepositoryRef(String aggregationRepositoryRef)
          Sets the custom aggregate repository to use

Will by default use MemoryAggregationRepository

 AggregateDefinition aggregationStrategy(AggregationStrategy aggregationStrategy)
          Sets the aggregate strategy to use
 AggregateDefinition aggregationStrategyRef(String aggregationStrategyRef)
          Sets the aggregate strategy to use
protected  void checkNoCompletedPredicate()
           
 AggregateDefinition closeCorrelationKeyOnCompletion(int capacity)
          Closes a correlation key when its complete.
 AggregateDefinition completionFromBatchConsumer()
          Enables the batch completion mode where we aggregate from a BatchConsumer and aggregate the total number of exchanges the BatchConsumer has reported as total by checking the exchange property Exchange.BATCH_COMPLETE when its complete.
 AggregateDefinition completionInterval(long completionInterval)
          Sets the completion interval, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.
 ExpressionClause<AggregateDefinition> completionPredicate()
          Sets the predicate used to determine if the aggregation is completed
 AggregateDefinition completionPredicate(Predicate predicate)
          Sets the predicate used to determine if the aggregation is completed
 AggregateDefinition completionSize(Expression completionSize)
          Sets the completion size, which is the number of aggregated exchanges which would cause the aggregate to consider the group as complete and send out the aggregated exchange.
 AggregateDefinition completionSize(int completionSize)
          Sets the completion size, which is the number of aggregated exchanges which would cause the aggregate to consider the group as complete and send out the aggregated exchange.
 AggregateDefinition completionTimeout(Expression completionTimeout)
          Sets the completion timeout, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.
 AggregateDefinition completionTimeout(long completionTimeout)
          Sets the completion timeout, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.
protected  AggregateProcessor createAggregator(RouteContext routeContext)
           
 ExpressionClause<AggregateDefinition> createAndSetExpression()
           
 Processor createProcessor(RouteContext routeContext)
          Override this in definition class and implement logic to create the processor based on the definition model.
 AggregateDefinition discardOnCompletionTimeout()
          Discards the aggregated message on completion timeout.
 AggregateDefinition eagerCheckCompletion()
          Use eager completion checking which means that the {{completionPredicate}} will use the incoming Exchange.
 AggregateDefinition executorService(ExecutorService executorService)
          Setting the executor service for executing
 AggregateDefinition executorServiceRef(String executorServiceRef)
          Setting the executor service for executing
 AggregationRepository getAggregationRepository()
           
 String getAggregationRepositoryRef()
           
 AggregationStrategy getAggregationStrategy()
           
 String getAggregationStrategyRef()
           
 Integer getCloseCorrelationKeyOnCompletion()
           
 Long getCompletionInterval()
           
 ExpressionSubElementDefinition getCompletionPredicate()
           
 Integer getCompletionSize()
           
 ExpressionSubElementDefinition getCompletionSizeExpression()
           
 Long getCompletionTimeout()
           
 ExpressionSubElementDefinition getCompletionTimeoutExpression()
           
 ExpressionSubElementDefinition getCorrelationExpression()
           
 ExecutorService getExecutorService()
          Gets the executor service
 String getExecutorServiceRef()
          Gets the reference to lookup in the Registry for the executor service to be used.
 ExpressionDefinition getExpression()
           
 String getLabel()
          Returns a label to describe this node such as the expression if some kind of expression node
 List<ProcessorDefinition> getOutputs()
           
 String getShortName()
          Returns a short name for this node which can be useful for ID generation or referring to related resources like images
 String getStrategyRef()
           
 AggregateDefinition groupExchanges()
          Enables grouped exchanges, so the aggregator will group all aggregated exchanges into a single combined Exchange holding all the aggregated exchanges in a List as a exchange property with the key Exchange.GROUPED_EXCHANGE.
 AggregateDefinition ignoreInvalidCorrelationKeys()
          If a correlation key cannot be successfully evaluated it will be ignored by logging a {{DEBUG}} and then just ignore the incoming Exchange.
 Boolean isCompletionFromBatchConsumer()
           
 Boolean isDiscardOnCompletionTimeout()
           
 Boolean isEagerCheckCompletion()
           
 Boolean isGroupExchanges()
           
 Boolean isIgnoreInvalidCorrelationKeys()
           
 boolean isParallelProcessing()
           
 AggregateDefinition parallelProcessing()
          Sending the aggregated output in parallel
 void setAggregationRepository(AggregationRepository aggregationRepository)
           
 void setAggregationRepositoryRef(String aggregationRepositoryRef)
           
 void setAggregationStrategy(AggregationStrategy aggregationStrategy)
           
 void setAggregationStrategyRef(String aggregationStrategyRef)
           
 void setCloseCorrelationKeyOnCompletion(Integer closeCorrelationKeyOnCompletion)
           
 void setCompletionFromBatchConsumer(Boolean completionFromBatchConsumer)
           
 void setCompletionInterval(Long completionInterval)
           
 void setCompletionPredicate(ExpressionSubElementDefinition completionPredicate)
           
 void setCompletionSize(Integer completionSize)
           
 void setCompletionSizeExpression(ExpressionSubElementDefinition completionSizeExpression)
           
 void setCompletionTimeout(Long completionTimeout)
           
 void setCompletionTimeoutExpression(ExpressionSubElementDefinition completionTimeoutExpression)
           
 void setCorrelationExpression(ExpressionSubElementDefinition correlationExpression)
           
 void setDiscardOnCompletionTimeout(Boolean discardOnCompletionTimeout)
           
 void setEagerCheckCompletion(Boolean eagerCheckCompletion)
           
 void setExecutorService(ExecutorService executorService)
          Sets the executor service to be used.
 void setExecutorServiceRef(String executorServiceRef)
          Sets a reference to lookup in the Registry for the executor service to be used.
 void setExpression(ExpressionDefinition expression)
           
 void setGroupExchanges(Boolean groupExchanges)
           
 void setIgnoreInvalidCorrelationKeys(Boolean ignoreInvalidCorrelationKeys)
           
 void setOutputs(List<ProcessorDefinition> outputs)
           
 void setParallelProcessing(boolean parallelProcessing)
           
 void setStrategyRef(String strategyRef)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createErrorHandlerBuilder, createOutputsProcessor, createOutputsProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, enrich, enrich, enrichRef, filter, filter, filter, filter, getErrorHandlerBuilder, getInterceptStrategies, getNodeFactory, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, loadBalance, loadBalance, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, process, processRef, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeProperty, resequence, resequence, resequence, resequence, resolvePropertyPlaceholders, rollback, rollback, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, setBody, setBody, setErrorHandlerBuilder, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setNodeFactory, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sortBody, sortBody, split, split, split, stop, threads, threads, threads, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AggregateDefinition

public AggregateDefinition()

AggregateDefinition

public AggregateDefinition(Predicate predicate)

AggregateDefinition

public AggregateDefinition(Expression correlationExpression)

AggregateDefinition

public AggregateDefinition(ExpressionDefinition correlationExpression)

AggregateDefinition

public AggregateDefinition(Expression correlationExpression,
                           AggregationStrategy aggregationStrategy)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getShortName

public String getShortName()
Description copied from class: OptionalIdentifiedDefinition
Returns a short name for this node which can be useful for ID generation or referring to related resources like images

Overrides:
getShortName in class OptionalIdentifiedDefinition
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

getLabel

public String getLabel()
Description copied from class: ProcessorDefinition
Returns a label to describe this node such as the expression if some kind of expression node

Overrides:
getLabel in class ProcessorDefinition<AggregateDefinition>

createProcessor

public Processor createProcessor(RouteContext routeContext)
                          throws Exception
Description copied from class: ProcessorDefinition
Override this in definition class and implement logic to create the processor based on the definition model.

Overrides:
createProcessor in class ProcessorDefinition<AggregateDefinition>
Throws:
Exception

createAndSetExpression

public ExpressionClause<AggregateDefinition> createAndSetExpression()

createAggregator

protected AggregateProcessor createAggregator(RouteContext routeContext)
                                       throws Exception
Throws:
Exception

getAggregationStrategy

public AggregationStrategy getAggregationStrategy()

setAggregationStrategy

public void setAggregationStrategy(AggregationStrategy aggregationStrategy)

getAggregationStrategyRef

public String getAggregationStrategyRef()

setAggregationStrategyRef

public void setAggregationStrategyRef(String aggregationStrategyRef)

getCompletionSize

public Integer getCompletionSize()

setCompletionSize

public void setCompletionSize(Integer completionSize)

getCompletionInterval

public Long getCompletionInterval()

setCompletionInterval

public void setCompletionInterval(Long completionInterval)

getCompletionTimeout

public Long getCompletionTimeout()

setCompletionTimeout

public void setCompletionTimeout(Long completionTimeout)

getCompletionPredicate

public ExpressionSubElementDefinition getCompletionPredicate()

setCompletionPredicate

public void setCompletionPredicate(ExpressionSubElementDefinition completionPredicate)

getCompletionTimeoutExpression

public ExpressionSubElementDefinition getCompletionTimeoutExpression()

setCompletionTimeoutExpression

public void setCompletionTimeoutExpression(ExpressionSubElementDefinition completionTimeoutExpression)

getCompletionSizeExpression

public ExpressionSubElementDefinition getCompletionSizeExpression()

setCompletionSizeExpression

public void setCompletionSizeExpression(ExpressionSubElementDefinition completionSizeExpression)

isGroupExchanges

public Boolean isGroupExchanges()

setGroupExchanges

public void setGroupExchanges(Boolean groupExchanges)

isCompletionFromBatchConsumer

public Boolean isCompletionFromBatchConsumer()

setCompletionFromBatchConsumer

public void setCompletionFromBatchConsumer(Boolean completionFromBatchConsumer)

getExecutorService

public ExecutorService getExecutorService()
Description copied from interface: ExecutorServiceAware
Gets the executor service

Specified by:
getExecutorService in interface ExecutorServiceAware
Returns:
the executor

setExecutorService

public void setExecutorService(ExecutorService executorService)
Description copied from interface: ExecutorServiceAware
Sets the executor service to be used.

Specified by:
setExecutorService in interface ExecutorServiceAware
Parameters:
executorService - the executor

isParallelProcessing

public boolean isParallelProcessing()

setParallelProcessing

public void setParallelProcessing(boolean parallelProcessing)

getExecutorServiceRef

public String getExecutorServiceRef()
Description copied from interface: ExecutorServiceAware
Gets the reference to lookup in the Registry for the executor service to be used.

Specified by:
getExecutorServiceRef in interface ExecutorServiceAware
Returns:
the reference, or null if the executor was set directly

setExecutorServiceRef

public void setExecutorServiceRef(String executorServiceRef)
Description copied from interface: ExecutorServiceAware
Sets a reference to lookup in the Registry for the executor service to be used.

Specified by:
setExecutorServiceRef in interface ExecutorServiceAware
Parameters:
executorServiceRef - reference for the executor

getStrategyRef

public String getStrategyRef()

setStrategyRef

public void setStrategyRef(String strategyRef)

isEagerCheckCompletion

public Boolean isEagerCheckCompletion()

setEagerCheckCompletion

public void setEagerCheckCompletion(Boolean eagerCheckCompletion)

isIgnoreInvalidCorrelationKeys

public Boolean isIgnoreInvalidCorrelationKeys()

setIgnoreInvalidCorrelationKeys

public void setIgnoreInvalidCorrelationKeys(Boolean ignoreInvalidCorrelationKeys)

getCloseCorrelationKeyOnCompletion

public Integer getCloseCorrelationKeyOnCompletion()

setCloseCorrelationKeyOnCompletion

public void setCloseCorrelationKeyOnCompletion(Integer closeCorrelationKeyOnCompletion)

getAggregationRepository

public AggregationRepository getAggregationRepository()

setAggregationRepository

public void setAggregationRepository(AggregationRepository aggregationRepository)

getAggregationRepositoryRef

public String getAggregationRepositoryRef()

setAggregationRepositoryRef

public void setAggregationRepositoryRef(String aggregationRepositoryRef)

isDiscardOnCompletionTimeout

public Boolean isDiscardOnCompletionTimeout()

setDiscardOnCompletionTimeout

public void setDiscardOnCompletionTimeout(Boolean discardOnCompletionTimeout)

eagerCheckCompletion

public AggregateDefinition eagerCheckCompletion()
Use eager completion checking which means that the {{completionPredicate}} will use the incoming Exchange. At opposed to without eager completion checking the {{completionPredicate}} will use the aggregated Exchange.

Returns:
builder

ignoreInvalidCorrelationKeys

public AggregateDefinition ignoreInvalidCorrelationKeys()
If a correlation key cannot be successfully evaluated it will be ignored by logging a {{DEBUG}} and then just ignore the incoming Exchange.

Returns:
builder

closeCorrelationKeyOnCompletion

public AggregateDefinition closeCorrelationKeyOnCompletion(int capacity)
Closes a correlation key when its complete. Any late received exchanges which has a correlation key that has been closed, it will be defined and a ClosedCorrelationKeyException is thrown.

Parameters:
capacity - the maximum capacity of the closed correlation key cache. Use 0 or negative value for unbounded capacity.
Returns:
builder

discardOnCompletionTimeout

public AggregateDefinition discardOnCompletionTimeout()
Discards the aggregated message on completion timeout.

This means on timeout the aggregated message is dropped and not sent out of the aggregator.

Returns:
builder

completionFromBatchConsumer

public AggregateDefinition completionFromBatchConsumer()
Enables the batch completion mode where we aggregate from a BatchConsumer and aggregate the total number of exchanges the BatchConsumer has reported as total by checking the exchange property Exchange.BATCH_COMPLETE when its complete.

Returns:
builder

completionSize

public AggregateDefinition completionSize(int completionSize)
Sets the completion size, which is the number of aggregated exchanges which would cause the aggregate to consider the group as complete and send out the aggregated exchange.

Parameters:
completionSize - the completion size
Returns:
builder

completionSize

public AggregateDefinition completionSize(Expression completionSize)
Sets the completion size, which is the number of aggregated exchanges which would cause the aggregate to consider the group as complete and send out the aggregated exchange.

Parameters:
completionSize - the completion size as an Expression which is evaluated as a Integer type
Returns:
builder

completionInterval

public AggregateDefinition completionInterval(long completionInterval)
Sets the completion interval, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.

Parameters:
completionInterval - the interval in millis
Returns:
the builder

completionTimeout

public AggregateDefinition completionTimeout(long completionTimeout)
Sets the completion timeout, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.

Parameters:
completionTimeout - the timeout in millis
Returns:
the builder

completionTimeout

public AggregateDefinition completionTimeout(Expression completionTimeout)
Sets the completion timeout, which would cause the aggregate to consider the group as complete and send out the aggregated exchange.

Parameters:
completionTimeout - the timeout as an Expression which is evaluated as a Long type
Returns:
the builder

aggregationStrategy

public AggregateDefinition aggregationStrategy(AggregationStrategy aggregationStrategy)
Sets the aggregate strategy to use

Parameters:
aggregationStrategy - the aggregate strategy to use
Returns:
the builder

aggregationStrategyRef

public AggregateDefinition aggregationStrategyRef(String aggregationStrategyRef)
Sets the aggregate strategy to use

Parameters:
aggregationStrategyRef - reference to the strategy to lookup in the registry
Returns:
the builder

aggregationRepository

public AggregateDefinition aggregationRepository(AggregationRepository aggregationRepository)
Sets the custom aggregate repository to use.

Will by default use MemoryAggregationRepository

Parameters:
aggregationRepository - the aggregate repository to use
Returns:
the builder

aggregationRepositoryRef

public AggregateDefinition aggregationRepositoryRef(String aggregationRepositoryRef)
Sets the custom aggregate repository to use

Will by default use MemoryAggregationRepository

Parameters:
aggregationRepositoryRef - reference to the repository to lookup in the registry
Returns:
the builder

groupExchanges

public AggregateDefinition groupExchanges()
Enables grouped exchanges, so the aggregator will group all aggregated exchanges into a single combined Exchange holding all the aggregated exchanges in a List as a exchange property with the key Exchange.GROUPED_EXCHANGE.

Returns:
the builder

completionPredicate

public ExpressionClause<AggregateDefinition> completionPredicate()
Sets the predicate used to determine if the aggregation is completed

Returns:
the clause used to create the predicate

completionPredicate

public AggregateDefinition completionPredicate(Predicate predicate)
Sets the predicate used to determine if the aggregation is completed

Parameters:
predicate - the predicate
Returns:
the builder

parallelProcessing

public AggregateDefinition parallelProcessing()
Sending the aggregated output in parallel

Returns:
the builder

executorService

public AggregateDefinition executorService(ExecutorService executorService)
Description copied from interface: ExecutorServiceAwareDefinition
Setting the executor service for executing

Specified by:
executorService in interface ExecutorServiceAwareDefinition<AggregateDefinition>
Parameters:
executorService - the executor service
Returns:
the builder

executorServiceRef

public AggregateDefinition executorServiceRef(String executorServiceRef)
Description copied from interface: ExecutorServiceAwareDefinition
Setting the executor service for executing

Specified by:
executorServiceRef in interface ExecutorServiceAwareDefinition<AggregateDefinition>
Parameters:
executorServiceRef - reference for a ExecutorService to lookup in the Registry
Returns:
the builder

checkNoCompletedPredicate

protected void checkNoCompletedPredicate()

setCorrelationExpression

public void setCorrelationExpression(ExpressionSubElementDefinition correlationExpression)

getCorrelationExpression

public ExpressionSubElementDefinition getCorrelationExpression()

getExpression

public ExpressionDefinition getExpression()

setExpression

public void setExpression(ExpressionDefinition expression)

getOutputs

public List<ProcessorDefinition> getOutputs()
Specified by:
getOutputs in class ProcessorDefinition<AggregateDefinition>

setOutputs

public void setOutputs(List<ProcessorDefinition> outputs)


Apache CAMEL