Package org.apache.camel.model
Class AggregateDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<Type>
-
- org.apache.camel.model.OutputDefinition<AggregateDefinition>
-
- org.apache.camel.model.AggregateDefinition
-
- All Implemented Interfaces:
org.apache.camel.ExecutorServiceAware
,Block
,ExecutorServiceAwareDefinition<AggregateDefinition>
,OutputNode
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
@Metadata(label="eip,routing") public class AggregateDefinition extends OutputDefinition<AggregateDefinition> implements ExecutorServiceAwareDefinition<AggregateDefinition>
Aggregates many messages into a single message
-
-
Field Summary
-
Fields inherited from class org.apache.camel.model.OutputDefinition
outputs
-
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler, log
-
-
Constructor Summary
Constructors Constructor Description AggregateDefinition()
AggregateDefinition(org.apache.camel.Expression expression)
AggregateDefinition(org.apache.camel.Expression correlationExpression, org.apache.camel.AggregationStrategy aggregationStrategy)
AggregateDefinition(ExpressionDefinition correlationExpression)
AggregateDefinition(org.apache.camel.Predicate predicate)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AggregateDefinition
aggregateController(Supplier<org.apache.camel.processor.aggregate.AggregateController> aggregateController)
To use aAggregateController
to allow external sources to control this aggregator.AggregateDefinition
aggregateController(org.apache.camel.processor.aggregate.AggregateController aggregateController)
To use aAggregateController
to allow external sources to control this aggregator.AggregateDefinition
aggregationRepository(Supplier<org.apache.camel.spi.AggregationRepository> aggregationRepository)
Sets the custom aggregate repository to use.AggregateDefinition
aggregationRepository(org.apache.camel.spi.AggregationRepository aggregationRepository)
Sets the custom aggregate repository to use.AggregateDefinition
aggregationRepositoryRef(String aggregationRepositoryRef)
Sets the custom aggregate repository to use.AggregationStrategyClause<AggregateDefinition>
aggregationStrategy()
Sets the AggregationStrategy to use with a fluent builder.AggregateDefinition
aggregationStrategy(Supplier<org.apache.camel.AggregationStrategy> aggregationStrategy)
Sets the aggregate strategy to useAggregateDefinition
aggregationStrategy(org.apache.camel.AggregationStrategy aggregationStrategy)
Sets the aggregate strategy to useAggregateDefinition
aggregationStrategyMethodAllowNull()
Sets allowing null when using a bean asAggregationStrategy
.AggregateDefinition
aggregationStrategyMethodName(String methodName)
Sets the method name to use when using a bean asAggregationStrategy
.AggregateDefinition
aggregationStrategyRef(String aggregationStrategyRef)
Sets the aggregate strategy to useprotected void
checkNoCompletedPredicate()
AggregateDefinition
closeCorrelationKeyOnCompletion(int capacity)
Closes a correlation key when its complete.AggregateDefinition
completeAllOnStop()
Indicates to wait to complete all current and partial (pending) aggregated exchanges when the context is stopped.PredicateClause<AggregateDefinition>
completion()
A Predicate to indicate when an aggregated exchange is complete.AggregateDefinition
completion(org.apache.camel.Predicate predicate)
A Predicate to indicate when an aggregated exchange is complete.AggregateDefinition
completionFromBatchConsumer()
Enables the batch completion mode where we aggregate from aBatchConsumer
and aggregate the total number of exchanges theBatchConsumer
has reported as total by checking the exchange propertyExchange.BATCH_COMPLETE
when its complete.AggregateDefinition
completionInterval(long completionInterval)
A repeating period in millis by which the aggregator will complete all current aggregated exchanges.AggregateDefinition
completionInterval(String completionInterval)
A repeating period in millis by which the aggregator will complete all current aggregated exchanges.AggregateDefinition
completionOnNewCorrelationGroup()
Enables completion on all previous groups when a new incoming correlation group.PredicateClause<AggregateDefinition>
completionPredicate()
A Predicate to indicate when an aggregated exchange is complete.AggregateDefinition
completionPredicate(org.apache.camel.Predicate predicate)
A Predicate to indicate when an aggregated exchange is complete.AggregateDefinition
completionSize(int completionSize)
Number of messages aggregated before the aggregation is complete.AggregateDefinition
completionSize(String completionSize)
Number of messages aggregated before the aggregation is complete.AggregateDefinition
completionSize(org.apache.camel.Expression completionSize)
Number of messages aggregated before the aggregation is complete.AggregateDefinition
completionTimeout(long completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout).AggregateDefinition
completionTimeout(String completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout).AggregateDefinition
completionTimeout(org.apache.camel.Expression completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout).AggregateDefinition
completionTimeoutCheckerInterval(long completionTimeoutCheckerInterval)
Interval in millis that is used by the background task that checks for timeouts (TimeoutMap
).void
configureChild(ProcessorDefinition<?> output)
Strategy for children to do any custom configurationprotected String
description()
AggregateDefinition
discardOnAggregationFailure()
Discards the aggregated message when aggregation failed (an exception was thrown fromAggregationStrategy
.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)
If using parallelProcessing you can specify a custom thread pool to be used.AggregateDefinition
executorServiceRef(String executorServiceRef)
If using parallelProcessing you can specify a custom thread pool to be used.AggregateDefinition
forceCompletionOnStop()
Indicates to complete all current aggregated exchanges when the context is stoppedorg.apache.camel.processor.aggregate.AggregateController
getAggregateController()
String
getAggregateControllerRef()
org.apache.camel.spi.AggregationRepository
getAggregationRepository()
String
getAggregationRepositoryRef()
org.apache.camel.AggregationStrategy
getAggregationStrategy()
String
getAggregationStrategyMethodName()
String
getAggregationStrategyRef()
String
getCloseCorrelationKeyOnCompletion()
String
getCompleteAllOnStop()
String
getCompletionFromBatchConsumer()
String
getCompletionInterval()
String
getCompletionOnNewCorrelationGroup()
ExpressionSubElementDefinition
getCompletionPredicate()
String
getCompletionSize()
ExpressionSubElementDefinition
getCompletionSizeExpression()
String
getCompletionTimeout()
String
getCompletionTimeoutCheckerInterval()
ExpressionSubElementDefinition
getCompletionTimeoutExpression()
ExpressionSubElementDefinition
getCorrelationExpression()
String
getDiscardOnAggregationFailure()
String
getDiscardOnCompletionTimeout()
String
getEagerCheckCompletion()
ExecutorService
getExecutorService()
String
getExecutorServiceRef()
ExpressionDefinition
getExpression()
String
getForceCompletionOnStop()
String
getIgnoreInvalidCorrelationKeys()
String
getLabel()
Returns a label to describe this node such as the expression if some kind of expression nodeString
getOptimisticLocking()
org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy
getOptimisticLockRetryPolicy()
OptimisticLockRetryPolicyDefinition
getOptimisticLockRetryPolicyDefinition()
List<ProcessorDefinition<?>>
getOutputs()
String
getParallelProcessing()
String
getShortName()
String
getStrategyMethodAllowNull()
String
getStrategyMethodName()
String
getStrategyRef()
ScheduledExecutorService
getTimeoutCheckerExecutorService()
String
getTimeoutCheckerExecutorServiceRef()
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.AggregateDefinition
optimisticLocking()
Turns on using optimistic locking, which requires the aggregationRepository being used, is supporting this by implementingOptimisticLockingAggregationRepository
.AggregateDefinition
optimisticLockRetryPolicy(org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy policy)
Allows to configure retry settings when using optimistic locking.AggregateDefinition
parallelProcessing()
When aggregated are completed they are being send out of the aggregator.AggregateDefinition
parallelProcessing(boolean parallelProcessing)
When aggregated are completed they are being send out of the aggregator.void
setAggregateController(org.apache.camel.processor.aggregate.AggregateController aggregateController)
void
setAggregateControllerRef(String aggregateControllerRef)
To use aAggregateController
to allow external sources to control this aggregator.void
setAggregationRepository(org.apache.camel.spi.AggregationRepository aggregationRepository)
void
setAggregationRepositoryRef(String aggregationRepositoryRef)
void
setAggregationStrategy(org.apache.camel.AggregationStrategy aggregationStrategy)
The AggregationStrategy to use.void
setAggregationStrategyMethodName(String strategyMethodName)
This option can be used to explicit declare the method name to use, when using beans as the AggregationStrategy.void
setAggregationStrategyRef(String aggregationStrategyRef)
A reference to lookup the AggregationStrategy in the Registry.void
setCloseCorrelationKeyOnCompletion(String closeCorrelationKeyOnCompletion)
void
setCompleteAllOnStop(String completeAllOnStop)
void
setCompletionFromBatchConsumer(String completionFromBatchConsumer)
void
setCompletionInterval(String completionInterval)
void
setCompletionOnNewCorrelationGroup(String completionOnNewCorrelationGroup)
void
setCompletionPredicate(ExpressionSubElementDefinition completionPredicate)
void
setCompletionSize(String completionSize)
void
setCompletionSizeExpression(ExpressionSubElementDefinition completionSizeExpression)
Number of messages aggregated before the aggregation is complete.void
setCompletionTimeout(String completionTimeout)
void
setCompletionTimeoutCheckerInterval(String completionTimeoutCheckerInterval)
void
setCompletionTimeoutExpression(ExpressionSubElementDefinition completionTimeoutExpression)
Time in millis that an aggregated exchange should be inactive before its complete (timeout).void
setCorrelationExpression(ExpressionSubElementDefinition correlationExpression)
The expression used to calculate the correlation key to use for aggregation.void
setDiscardOnAggregationFailure(String discardOnAggregationFailure)
void
setDiscardOnCompletionTimeout(String discardOnCompletionTimeout)
void
setEagerCheckCompletion(String eagerCheckCompletion)
void
setExecutorService(ExecutorService executorService)
void
setExecutorServiceRef(String executorServiceRef)
void
setExpression(org.apache.camel.Expression expression)
void
setExpression(ExpressionDefinition expression)
void
setForceCompletionOnStop(String forceCompletionOnStop)
void
setIgnoreInvalidCorrelationKeys(String ignoreInvalidCorrelationKeys)
void
setOptimisticLocking(String optimisticLocking)
void
setOptimisticLockRetryPolicy(org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy optimisticLockRetryPolicy)
void
setOptimisticLockRetryPolicyDefinition(OptimisticLockRetryPolicyDefinition optimisticLockRetryPolicyDefinition)
void
setOutputs(List<ProcessorDefinition<?>> outputs)
void
setParallelProcessing(String parallelProcessing)
void
setStrategyMethodAllowNull(String strategyMethodAllowNull)
If this option is false then the aggregate method is not used for the very first aggregation.void
setStrategyMethodName(String strategyMethodName)
This option can be used to explicit declare the method name to use, when using beans as the AggregationStrategy.void
setStrategyRef(String strategyRef)
A reference to lookup the AggregationStrategy in the Registry.void
setTimeoutCheckerExecutorService(ScheduledExecutorService timeoutCheckerExecutorService)
void
setTimeoutCheckerExecutorServiceRef(String timeoutCheckerExecutorServiceRef)
AggregationStrategyClause<AggregateDefinition>
strategy()
Deprecated.AggregateDefinition
strategy(org.apache.camel.AggregationStrategy aggregationStrategy)
Deprecated.AggregateDefinition
timeoutCheckerExecutorService(ScheduledExecutorService executorService)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator.AggregateDefinition
timeoutCheckerExecutorService(Supplier<ScheduledExecutorService> executorService)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator.AggregateDefinition
timeoutCheckerExecutorServiceRef(String executorServiceRef)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator.String
toString()
-
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategy, addOutput, aggregate, aggregate, aggregate, aggregate, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, choice, circuitBreaker, claimCheck, claimCheck, claimCheck, claimCheck, clearOutput, convertBodyTo, convertBodyTo, convertBodyTo, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endCircuitBreaker, endDoCatch, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, isWrappingEntireOutput, kamelet, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, loopDoWhile, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, preCreateProcessor, process, process, process, recipientList, recipientList, recipientList, recipientList, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setHeader, setHeader, setHeader, setInheritErrorHandler, setParent, setProperty, setProperty, setProperty, sort, sort, sort, split, split, split, split, startupOrder, step, step, stop, threads, threads, threads, threads, throttle, throttle, throttle, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, to, to, to, to, toD, toD, toD, toD, toD, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap
-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, description, getCustomId, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setGeneratedId, setId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.model.ExecutorServiceAwareDefinition
executorService
-
-
-
-
Constructor Detail
-
AggregateDefinition
public AggregateDefinition()
-
AggregateDefinition
public AggregateDefinition(@AsPredicate org.apache.camel.Predicate predicate)
-
AggregateDefinition
public AggregateDefinition(org.apache.camel.Expression expression)
-
AggregateDefinition
public AggregateDefinition(ExpressionDefinition correlationExpression)
-
AggregateDefinition
public AggregateDefinition(org.apache.camel.Expression correlationExpression, org.apache.camel.AggregationStrategy aggregationStrategy)
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toString
in classOutputDefinition<AggregateDefinition>
-
description
protected String description()
-
getShortName
public String getShortName()
- Specified by:
getShortName
in interfaceorg.apache.camel.NamedNode
- Overrides:
getShortName
in classOutputDefinition<AggregateDefinition>
-
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- Specified by:
getLabel
in interfaceorg.apache.camel.NamedNode
- Overrides:
getLabel
in classProcessorDefinition<AggregateDefinition>
-
configureChild
public void configureChild(ProcessorDefinition<?> output)
Description copied from class:ProcessorDefinition
Strategy for children to do any custom configuration- Overrides:
configureChild
in classProcessorDefinition<AggregateDefinition>
- Parameters:
output
- the child to be added as output to this
-
getAggregationStrategy
public org.apache.camel.AggregationStrategy getAggregationStrategy()
-
setAggregationStrategy
public void setAggregationStrategy(org.apache.camel.AggregationStrategy aggregationStrategy)
The AggregationStrategy to use. For example to lookup a bean with the name foo, the value is simply just foo. However its also possible to create a new class: Values can refer to creating new beans by their class name by prefixing with #class, eg #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to create the instance via a factory method then you specify the method as shown: #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello World', 5, true). Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange.
-
getAggregationStrategyRef
public String getAggregationStrategyRef()
-
setAggregationStrategyRef
public void setAggregationStrategyRef(String aggregationStrategyRef)
A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean:- Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)
- reference by type - Values can refer to singleton beans by their type in the registry by prefixing with #type: syntax, eg #type:com.foo.MyClassType
- reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to create the instance via a factory method then you specify the method as shown: #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello World', 5, true) .
-
getStrategyRef
public String getStrategyRef()
-
setStrategyRef
public void setStrategyRef(String strategyRef)
A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean:- Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)
- reference by type - Values can refer to singleton beans by their type in the registry by prefixing with #type: syntax, eg #type:com.foo.MyClassType
- reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to create the instance via a factory method then you specify the method as shown: #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello World', 5, true) .
-
getAggregationStrategyMethodName
public String getAggregationStrategyMethodName()
-
setAggregationStrategyMethodName
public void setAggregationStrategyMethodName(String strategyMethodName)
This option can be used to explicit declare the method name to use, when using beans as the AggregationStrategy.
-
getStrategyMethodAllowNull
public String getStrategyMethodAllowNull()
-
getStrategyMethodName
public String getStrategyMethodName()
-
setStrategyMethodName
public void setStrategyMethodName(String strategyMethodName)
This option can be used to explicit declare the method name to use, when using beans as the AggregationStrategy.
-
setStrategyMethodAllowNull
public void setStrategyMethodAllowNull(String strategyMethodAllowNull)
If this option is false then the aggregate method is not used for the very first aggregation. If this option is true then null values is used as the oldExchange (at the very first aggregation), when using beans as the AggregationStrategy.
-
setCorrelationExpression
public void setCorrelationExpression(ExpressionSubElementDefinition correlationExpression)
The expression used to calculate the correlation key to use for aggregation. The Exchange which has the same correlation key is aggregated together. If the correlation key could not be evaluated an Exception is thrown. You can disable this by using the ignoreBadCorrelationKeys option.
-
getCorrelationExpression
public ExpressionSubElementDefinition getCorrelationExpression()
-
getCompletionSize
public String getCompletionSize()
-
setCompletionSize
public void setCompletionSize(String completionSize)
-
getOptimisticLockRetryPolicyDefinition
public OptimisticLockRetryPolicyDefinition getOptimisticLockRetryPolicyDefinition()
-
setOptimisticLockRetryPolicyDefinition
public void setOptimisticLockRetryPolicyDefinition(OptimisticLockRetryPolicyDefinition optimisticLockRetryPolicyDefinition)
-
getOptimisticLockRetryPolicy
public org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy getOptimisticLockRetryPolicy()
-
setOptimisticLockRetryPolicy
public void setOptimisticLockRetryPolicy(org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy optimisticLockRetryPolicy)
-
getCompletionInterval
public String getCompletionInterval()
-
setCompletionInterval
public void setCompletionInterval(String completionInterval)
-
getCompletionTimeout
public String getCompletionTimeout()
-
setCompletionTimeout
public void setCompletionTimeout(String completionTimeout)
-
getCompletionTimeoutCheckerInterval
public String getCompletionTimeoutCheckerInterval()
-
setCompletionTimeoutCheckerInterval
public void setCompletionTimeoutCheckerInterval(String completionTimeoutCheckerInterval)
-
getCompletionPredicate
public ExpressionSubElementDefinition getCompletionPredicate()
-
setCompletionPredicate
public void setCompletionPredicate(ExpressionSubElementDefinition completionPredicate)
-
getCompletionTimeoutExpression
public ExpressionSubElementDefinition getCompletionTimeoutExpression()
-
setCompletionTimeoutExpression
public void setCompletionTimeoutExpression(ExpressionSubElementDefinition completionTimeoutExpression)
Time in millis that an aggregated exchange should be inactive before its complete (timeout). This option can be set as either a fixed value or using an Expression which allows you to evaluate a timeout dynamically - will use Long as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. You cannot use this option together with completionInterval, only one of the two can be used. By default the timeout checker runs every second, you can use the completionTimeoutCheckerInterval option to configure how frequently to run the checker. The timeout is an approximation and there is no guarantee that the a timeout is triggered exactly after the timeout value. It is not recommended to use very low timeout values or checker intervals.- Parameters:
completionTimeoutExpression
- the timeout as anExpression
which is evaluated as aLong
type
-
getCompletionSizeExpression
public ExpressionSubElementDefinition getCompletionSizeExpression()
-
setCompletionSizeExpression
public void setCompletionSizeExpression(ExpressionSubElementDefinition completionSizeExpression)
Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0.- Parameters:
completionSizeExpression
- the completion size as anExpression
which is evaluated as aInteger
type
-
getCompletionFromBatchConsumer
public String getCompletionFromBatchConsumer()
-
setCompletionFromBatchConsumer
public void setCompletionFromBatchConsumer(String completionFromBatchConsumer)
-
getCompletionOnNewCorrelationGroup
public String getCompletionOnNewCorrelationGroup()
-
setCompletionOnNewCorrelationGroup
public void setCompletionOnNewCorrelationGroup(String completionOnNewCorrelationGroup)
-
getExecutorService
public ExecutorService getExecutorService()
- Specified by:
getExecutorService
in interfaceorg.apache.camel.ExecutorServiceAware
-
setExecutorService
public void setExecutorService(ExecutorService executorService)
- Specified by:
setExecutorService
in interfaceorg.apache.camel.ExecutorServiceAware
-
getOptimisticLocking
public String getOptimisticLocking()
-
setOptimisticLocking
public void setOptimisticLocking(String optimisticLocking)
-
getParallelProcessing
public String getParallelProcessing()
-
setParallelProcessing
public void setParallelProcessing(String parallelProcessing)
-
getExecutorServiceRef
public String getExecutorServiceRef()
- Specified by:
getExecutorServiceRef
in interfaceorg.apache.camel.ExecutorServiceAware
-
setExecutorServiceRef
public void setExecutorServiceRef(String executorServiceRef)
- Specified by:
setExecutorServiceRef
in interfaceorg.apache.camel.ExecutorServiceAware
-
getEagerCheckCompletion
public String getEagerCheckCompletion()
-
setEagerCheckCompletion
public void setEagerCheckCompletion(String eagerCheckCompletion)
-
getIgnoreInvalidCorrelationKeys
public String getIgnoreInvalidCorrelationKeys()
-
setIgnoreInvalidCorrelationKeys
public void setIgnoreInvalidCorrelationKeys(String ignoreInvalidCorrelationKeys)
-
getCloseCorrelationKeyOnCompletion
public String getCloseCorrelationKeyOnCompletion()
-
setCloseCorrelationKeyOnCompletion
public void setCloseCorrelationKeyOnCompletion(String closeCorrelationKeyOnCompletion)
-
getAggregationRepository
public org.apache.camel.spi.AggregationRepository getAggregationRepository()
-
setAggregationRepository
public void setAggregationRepository(org.apache.camel.spi.AggregationRepository aggregationRepository)
-
getAggregationRepositoryRef
public String getAggregationRepositoryRef()
-
setAggregationRepositoryRef
public void setAggregationRepositoryRef(String aggregationRepositoryRef)
-
getDiscardOnCompletionTimeout
public String getDiscardOnCompletionTimeout()
-
setDiscardOnCompletionTimeout
public void setDiscardOnCompletionTimeout(String discardOnCompletionTimeout)
-
getDiscardOnAggregationFailure
public String getDiscardOnAggregationFailure()
-
setDiscardOnAggregationFailure
public void setDiscardOnAggregationFailure(String discardOnAggregationFailure)
-
setTimeoutCheckerExecutorService
public void setTimeoutCheckerExecutorService(ScheduledExecutorService timeoutCheckerExecutorService)
-
getTimeoutCheckerExecutorService
public ScheduledExecutorService getTimeoutCheckerExecutorService()
-
setTimeoutCheckerExecutorServiceRef
public void setTimeoutCheckerExecutorServiceRef(String timeoutCheckerExecutorServiceRef)
-
getTimeoutCheckerExecutorServiceRef
public String getTimeoutCheckerExecutorServiceRef()
-
getForceCompletionOnStop
public String getForceCompletionOnStop()
-
setForceCompletionOnStop
public void setForceCompletionOnStop(String forceCompletionOnStop)
-
getCompleteAllOnStop
public String getCompleteAllOnStop()
-
setCompleteAllOnStop
public void setCompleteAllOnStop(String completeAllOnStop)
-
getAggregateController
public org.apache.camel.processor.aggregate.AggregateController getAggregateController()
-
setAggregateController
public void setAggregateController(org.apache.camel.processor.aggregate.AggregateController aggregateController)
-
getAggregateControllerRef
public String getAggregateControllerRef()
-
setAggregateControllerRef
public void setAggregateControllerRef(String aggregateControllerRef)
To use aAggregateController
to allow external sources to control this aggregator.
-
eagerCheckCompletion
public AggregateDefinition eagerCheckCompletion()
Use eager completion checking which means that the completionPredicate will use the incoming Exchange. As 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
-
discardOnAggregationFailure
public AggregateDefinition discardOnAggregationFailure()
Discards the aggregated message when aggregation failed (an exception was thrown fromAggregationStrategy
. This means the partly aggregated message is dropped and not sent out of the aggregator. This option cannot be used together with completionFromBatchConsumer.- Returns:
- builder
-
completionFromBatchConsumer
public AggregateDefinition completionFromBatchConsumer()
Enables the batch completion mode where we aggregate from aBatchConsumer
and aggregate the total number of exchanges theBatchConsumer
has reported as total by checking the exchange propertyExchange.BATCH_COMPLETE
when its complete. This option cannot be used together with discardOnAggregationFailure.- Returns:
- builder
-
completionOnNewCorrelationGroup
public AggregateDefinition completionOnNewCorrelationGroup()
Enables completion on all previous groups when a new incoming correlation group. This can for example be used to complete groups with same correlation keys when they are in consecutive order. Notice when this is enabled then only 1 correlation group can be in progress as when a new correlation group starts, then the previous groups is forced completed.- Returns:
- builder
-
completionSize
public AggregateDefinition completionSize(String completionSize)
Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0.- Parameters:
completionSize
- the completion size, must be a an expression evaluating to positive number- Returns:
- builder
-
completionSize
public AggregateDefinition completionSize(int completionSize)
Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0.- Parameters:
completionSize
- the completion size, must be a positive number- Returns:
- builder
-
completionSize
public AggregateDefinition completionSize(org.apache.camel.Expression completionSize)
Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0.- Parameters:
completionSize
- the completion size as anExpression
which is evaluated as aInteger
type- Returns:
- builder
-
completionInterval
public AggregateDefinition completionInterval(long completionInterval)
A repeating period in millis by which the aggregator will complete all current aggregated exchanges. Camel has a background task which is triggered every period. You cannot use this option together with completionTimeout, only one of them can be used.- Parameters:
completionInterval
- the interval in millis, must be a positive value- Returns:
- the builder
-
completionInterval
public AggregateDefinition completionInterval(String completionInterval)
A repeating period in millis by which the aggregator will complete all current aggregated exchanges. Camel has a background task which is triggered every period. You cannot use this option together with completionTimeout, only one of them can be used.- Parameters:
completionInterval
- the interval in millis, must be a positive value- Returns:
- the builder
-
completionTimeout
public AggregateDefinition completionTimeout(String completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout). This option can be set as either a fixed value or using an Expression which allows you to evaluate a timeout dynamically - will use Long as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. You cannot use this option together with completionInterval, only one of the two can be used. By default the timeout checker runs every second, you can use the completionTimeoutCheckerInterval option to configure how frequently to run the checker. The timeout is an approximation and there is no guarantee that the a timeout is triggered exactly after the timeout value. It is not recommended to use very low timeout values or checker intervals.- Parameters:
completionTimeout
- the timeout in millis, must be a positive value- Returns:
- the builder
-
completionTimeout
public AggregateDefinition completionTimeout(long completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout). This option can be set as either a fixed value or using an Expression which allows you to evaluate a timeout dynamically - will use Long as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. You cannot use this option together with completionInterval, only one of the two can be used. By default the timeout checker runs every second, you can use the completionTimeoutCheckerInterval option to configure how frequently to run the checker. The timeout is an approximation and there is no guarantee that the a timeout is triggered exactly after the timeout value. It is not recommended to use very low timeout values or checker intervals.- Parameters:
completionTimeout
- the timeout in millis, must be a positive value- Returns:
- the builder
-
completionTimeout
public AggregateDefinition completionTimeout(org.apache.camel.Expression completionTimeout)
Time in millis that an aggregated exchange should be inactive before its complete (timeout). This option can be set as either a fixed value or using an Expression which allows you to evaluate a timeout dynamically - will use Long as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. You cannot use this option together with completionInterval, only one of the two can be used. By default the timeout checker runs every second, you can use the completionTimeoutCheckerInterval option to configure how frequently to run the checker. The timeout is an approximation and there is no guarantee that the a timeout is triggered exactly after the timeout value. It is not recommended to use very low timeout values or checker intervals.- Parameters:
completionTimeout
- the timeout as anExpression
which is evaluated as aLong
type- Returns:
- the builder
-
completionTimeoutCheckerInterval
public AggregateDefinition completionTimeoutCheckerInterval(long completionTimeoutCheckerInterval)
Interval in millis that is used by the background task that checks for timeouts (TimeoutMap
). By default the timeout checker runs every second. The timeout is an approximation and there is no guarantee that the a timeout is triggered exactly after the timeout value. It is not recommended to use very low timeout values or checker intervals.- Parameters:
completionTimeoutCheckerInterval
- the interval in millis, must be a positive value- Returns:
- the builder
-
aggregationStrategy
public AggregationStrategyClause<AggregateDefinition> aggregationStrategy()
Sets the AggregationStrategy to use with a fluent builder.
-
strategy
@Deprecated public AggregationStrategyClause<AggregateDefinition> strategy()
Deprecated.Sets the AggregationStrategy to use with a fluent builder.
-
strategy
@Deprecated public AggregateDefinition strategy(org.apache.camel.AggregationStrategy aggregationStrategy)
Deprecated.Sets the aggregate strategy to use- Parameters:
aggregationStrategy
- the aggregate strategy to use- Returns:
- the builder
-
aggregationStrategy
public AggregateDefinition aggregationStrategy(org.apache.camel.AggregationStrategy aggregationStrategy)
Sets the aggregate strategy to use- Parameters:
aggregationStrategy
- the aggregate strategy to use- Returns:
- the builder
-
aggregationStrategy
public AggregateDefinition aggregationStrategy(Supplier<org.apache.camel.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
-
aggregationStrategyMethodName
public AggregateDefinition aggregationStrategyMethodName(String methodName)
Sets the method name to use when using a bean asAggregationStrategy
.- Parameters:
methodName
- the method name to call- Returns:
- the builder
-
aggregationStrategyMethodAllowNull
public AggregateDefinition aggregationStrategyMethodAllowNull()
Sets allowing null when using a bean asAggregationStrategy
.- Returns:
- the builder
-
aggregationRepository
public AggregateDefinition aggregationRepository(org.apache.camel.spi.AggregationRepository aggregationRepository)
Sets the custom aggregate repository to use. Will by default useMemoryAggregationRepository
- Parameters:
aggregationRepository
- the aggregate repository to use- Returns:
- the builder
-
aggregationRepository
public AggregateDefinition aggregationRepository(Supplier<org.apache.camel.spi.AggregationRepository> aggregationRepository)
Sets the custom aggregate repository to use. Will by default useMemoryAggregationRepository
- 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 useMemoryAggregationRepository
- Parameters:
aggregationRepositoryRef
- reference to the repository to lookup in the registry- Returns:
- the builder
-
completionPredicate
public AggregateDefinition completionPredicate(@AsPredicate org.apache.camel.Predicate predicate)
A Predicate to indicate when an aggregated exchange is complete. If this is not specified and the AggregationStrategy object implements Predicate, the aggregationStrategy object will be used as the completionPredicate.
-
completionPredicate
@AsPredicate public PredicateClause<AggregateDefinition> completionPredicate()
A Predicate to indicate when an aggregated exchange is complete. If this is not specified and the AggregationStrategy object implements Predicate, the aggregationStrategy object will be used as the completionPredicate.
-
completion
@AsPredicate public PredicateClause<AggregateDefinition> completion()
A Predicate to indicate when an aggregated exchange is complete. If this is not specified and the AggregationStrategy object implements Predicate, the aggregationStrategy object will be used as the completionPredicate.
-
completion
public AggregateDefinition completion(@AsPredicate org.apache.camel.Predicate predicate)
A Predicate to indicate when an aggregated exchange is complete. If this is not specified and the AggregationStrategy object implements Predicate, the aggregationStrategy object will be used as the completionPredicate.
-
forceCompletionOnStop
public AggregateDefinition forceCompletionOnStop()
Indicates to complete all current aggregated exchanges when the context is stopped
-
completeAllOnStop
public AggregateDefinition completeAllOnStop()
Indicates to wait to complete all current and partial (pending) aggregated exchanges when the context is stopped. This also means that we will wait for all pending exchanges which are stored in the aggregation repository to complete so the repository is empty before we can stop. You may want to enable this when using the memory based aggregation repository that is memory based only, and do not store data on disk. When this option is enabled, then the aggregator is waiting to complete all those exchanges before its stopped, when stopping CamelContext or the route using it.
-
parallelProcessing
public AggregateDefinition parallelProcessing()
When aggregated are completed they are being send out of the aggregator. This option indicates whether or not Camel should use a thread pool with multiple threads for concurrency. If no custom thread pool has been specified then Camel creates a default pool with 10 concurrent threads.
-
parallelProcessing
public AggregateDefinition parallelProcessing(boolean parallelProcessing)
When aggregated are completed they are being send out of the aggregator. This option indicates whether or not Camel should use a thread pool with multiple threads for concurrency. If no custom thread pool has been specified then Camel creates a default pool with 10 concurrent threads.
-
optimisticLocking
public AggregateDefinition optimisticLocking()
Turns on using optimistic locking, which requires the aggregationRepository being used, is supporting this by implementingOptimisticLockingAggregationRepository
.
-
optimisticLockRetryPolicy
public AggregateDefinition optimisticLockRetryPolicy(org.apache.camel.processor.aggregate.OptimisticLockRetryPolicy policy)
Allows to configure retry settings when using optimistic locking.
-
executorService
public AggregateDefinition executorService(ExecutorService executorService)
If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well.- Specified by:
executorService
in interfaceExecutorServiceAwareDefinition<AggregateDefinition>
- Parameters:
executorService
- the executor service- Returns:
- the builder
-
executorServiceRef
public AggregateDefinition executorServiceRef(String executorServiceRef)
If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well.- Specified by:
executorServiceRef
in interfaceExecutorServiceAwareDefinition<AggregateDefinition>
- Parameters:
executorServiceRef
- reference for aExecutorService
to lookup in theRegistry
- Returns:
- the builder
-
timeoutCheckerExecutorService
public AggregateDefinition timeoutCheckerExecutorService(ScheduledExecutorService executorService)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool to be used rather than creating a new thread for every aggregator.
-
timeoutCheckerExecutorService
public AggregateDefinition timeoutCheckerExecutorService(Supplier<ScheduledExecutorService> executorService)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool to be used rather than creating a new thread for every aggregator.
-
timeoutCheckerExecutorServiceRef
public AggregateDefinition timeoutCheckerExecutorServiceRef(String executorServiceRef)
If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool to be used rather than creating a new thread for every aggregator.
-
aggregateController
public AggregateDefinition aggregateController(org.apache.camel.processor.aggregate.AggregateController aggregateController)
To use aAggregateController
to allow external sources to control this aggregator.
-
aggregateController
public AggregateDefinition aggregateController(Supplier<org.apache.camel.processor.aggregate.AggregateController> aggregateController)
To use aAggregateController
to allow external sources to control this aggregator.
-
getExpression
public ExpressionDefinition getExpression()
-
setExpression
public void setExpression(ExpressionDefinition expression)
-
setExpression
public void setExpression(org.apache.camel.Expression expression)
-
checkNoCompletedPredicate
protected void checkNoCompletedPredicate()
-
getOutputs
public List<ProcessorDefinition<?>> getOutputs()
- Overrides:
getOutputs
in classOutputDefinition<AggregateDefinition>
-
setOutputs
public void setOutputs(List<ProcessorDefinition<?>> outputs)
- Overrides:
setOutputs
in classOutputDefinition<AggregateDefinition>
-
-