org.apache.camel.model
Class AggregateDefinition

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

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

Represents an XML <aggregate/> element

Version:

Field Summary
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
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.
 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  void configureChild(ProcessorDefinition<?> output)
          Strategy for children to do any custom configuration
protected  AggregateProcessor createAggregator(RouteContext routeContext)
           
 Processor createProcessor(RouteContext routeContext)
          Override this in definition class and implement logic to create the processor based on the definition model.
protected  String description()
           
 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
 AggregateDefinition forceCompletionOnStop()
          Sets the force completion on stop flag, which considers the current group as complete and sends out the aggregated exchange when the stop event is executed
 AggregationRepository getAggregationRepository()
           
 String getAggregationRepositoryRef()
           
 AggregationStrategy getAggregationStrategy()
           
 String getAggregationStrategyRef()
           
 Integer getCloseCorrelationKeyOnCompletion()
           
 Boolean getCompletionFromBatchConsumer()
           
 Long getCompletionInterval()
           
 ExpressionSubElementDefinition getCompletionPredicate()
           
 Integer getCompletionSize()
           
 ExpressionSubElementDefinition getCompletionSizeExpression()
           
 Long getCompletionTimeout()
           
 ExpressionSubElementDefinition getCompletionTimeoutExpression()
           
 ExpressionSubElementDefinition getCorrelationExpression()
           
 Boolean getDiscardOnCompletionTimeout()
           
 Boolean getEagerCheckCompletion()
           
 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()
           
 Boolean getForceCompletionOnStop()
           
 Boolean getGroupExchanges()
           
 Boolean getIgnoreInvalidCorrelationKeys()
           
 String getLabel()
          Returns a label to describe this node such as the expression if some kind of expression node
 List<ProcessorDefinition<?>> getOutputs()
           
 Boolean getParallelProcessing()
           
 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()
           
 ScheduledExecutorService getTimeoutCheckerExecutorService()
           
 String getTimeoutCheckerExecutorServiceRef()
           
 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 isForceCompletionOnStop()
           
 boolean isGroupExchanges()
           
 boolean isIgnoreInvalidCorrelationKeys()
           
 boolean isOutputSupported()
           
 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 setForceCompletionOnStop(Boolean forceCompletionOnStop)
           
 void setGroupExchanges(Boolean groupExchanges)
           
 void setIgnoreInvalidCorrelationKeys(Boolean ignoreInvalidCorrelationKeys)
           
 void setOutputs(List<ProcessorDefinition<?>> outputs)
           
 void setParallelProcessing(boolean parallelProcessing)
           
 void setStrategyRef(String strategyRef)
           
 void setTimeoutCheckerExecutorService(ScheduledExecutorService timeoutCheckerExecutorService)
           
 void setTimeoutCheckerExecutorServiceRef(String timeoutCheckerExecutorServiceRef)
           
 AggregateDefinition timeoutCheckerExecutorService(ScheduledExecutorService executorService)
           
 AggregateDefinition timeoutCheckerExecutorServiceRef(String executorServiceRef)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, enrich, enrich, enrichRef, filter, filter, filter, filter, getInterceptStrategies, getNodeFactory, getOtherAttributes, 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, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, preCreateProcessor, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperty, resequence, resequence, resolveKnownConstantFields, resolvePropertyPlaceholders, rollback, rollback, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setNodeFactory, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, stop, threads, threads, threads, threads, throttle, 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

description

protected String description()

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

Specified by:
getShortName in interface NamedNode
Overrides:
getShortName in class OptionalIdentifiedDefinition<AggregateDefinition>
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

createAggregator

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

configureChild

protected void configureChild(ProcessorDefinition<?> output)
Description copied from class: ProcessorDefinition
Strategy for children to do any custom configuration

Overrides:
configureChild in class ProcessorDefinition<AggregateDefinition>
Parameters:
output - the child to be added as output to this

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)

getGroupExchanges

public Boolean getGroupExchanges()

isGroupExchanges

public boolean isGroupExchanges()

setGroupExchanges

public void setGroupExchanges(Boolean groupExchanges)

getCompletionFromBatchConsumer

public Boolean getCompletionFromBatchConsumer()

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

getParallelProcessing

public Boolean getParallelProcessing()

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)

getEagerCheckCompletion

public Boolean getEagerCheckCompletion()

isEagerCheckCompletion

public boolean isEagerCheckCompletion()

setEagerCheckCompletion

public void setEagerCheckCompletion(Boolean eagerCheckCompletion)

getIgnoreInvalidCorrelationKeys

public Boolean getIgnoreInvalidCorrelationKeys()

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)

getDiscardOnCompletionTimeout

public Boolean getDiscardOnCompletionTimeout()

isDiscardOnCompletionTimeout

public boolean isDiscardOnCompletionTimeout()

setDiscardOnCompletionTimeout

public void setDiscardOnCompletionTimeout(Boolean discardOnCompletionTimeout)

setTimeoutCheckerExecutorService

public void setTimeoutCheckerExecutorService(ScheduledExecutorService timeoutCheckerExecutorService)

getTimeoutCheckerExecutorService

public ScheduledExecutorService getTimeoutCheckerExecutorService()

setTimeoutCheckerExecutorServiceRef

public void setTimeoutCheckerExecutorServiceRef(String timeoutCheckerExecutorServiceRef)

getTimeoutCheckerExecutorServiceRef

public String getTimeoutCheckerExecutorServiceRef()

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 AggregateDefinition completionPredicate(Predicate predicate)
Sets the predicate used to determine if the aggregation is completed

Parameters:
predicate - the predicate
Returns:
the builder

forceCompletionOnStop

public AggregateDefinition forceCompletionOnStop()
Sets the force completion on stop flag, which considers the current group as complete and sends out the aggregated exchange when the stop event is executed

Returns:
builder

getForceCompletionOnStop

public Boolean getForceCompletionOnStop()

isForceCompletionOnStop

public boolean isForceCompletionOnStop()

setForceCompletionOnStop

public void setForceCompletionOnStop(Boolean forceCompletionOnStop)

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

timeoutCheckerExecutorService

public AggregateDefinition timeoutCheckerExecutorService(ScheduledExecutorService executorService)

timeoutCheckerExecutorServiceRef

public AggregateDefinition timeoutCheckerExecutorServiceRef(String executorServiceRef)

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>

isOutputSupported

public boolean isOutputSupported()
Specified by:
isOutputSupported in class ProcessorDefinition<AggregateDefinition>

setOutputs

public void setOutputs(List<ProcessorDefinition<?>> outputs)


Apache CAMEL