Class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,H>,H extends AbstractCorrelatingMessageHandler>
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,reactor.util.function.Tuple2<F,H>>
org.springframework.integration.dsl.EndpointSpec<S,ConsumerEndpointFactoryBean,H>
org.springframework.integration.dsl.ConsumerEndpointSpec<S,H>
org.springframework.integration.dsl.CorrelationHandlerSpec<S,H>
- Type Parameters:
S
- the targetCorrelationHandlerSpec
implementation type.H
- theAbstractCorrelatingMessageHandler
implementation type.
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,DisposableBean
,FactoryBean<reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,
,H>> InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
,ComponentsRegistration
- Direct Known Subclasses:
AggregatorSpec
,ResequencerSpec
public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,H>,H extends AbstractCorrelatingMessageHandler>
extends ConsumerEndpointSpec<S,H>
- Since:
- 5.0
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.ConsumerEndpointSpec
adviceChain
Fields inherited from class org.springframework.integration.dsl.EndpointSpec
componentsToRegister, endpointFactoryBean, handler
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncorrelationExpression
(String correlationExpression) Configure the handler with anExpressionEvaluatingCorrelationStrategy
for the given expression.correlationStrategy
(Object target, String methodName) Configure the handler with anMethodInvokingCorrelationStrategy
for the target object and method name.correlationStrategy
(CorrelationStrategy correlationStrategy) discardChannel
(String discardChannelName) discardChannel
(MessageChannel discardChannel) expireDuration
(Duration expireDuration) Configure aDuration
how often to run a scheduled purge task.expireGroupsUponTimeout
(boolean expireGroupsUponTimeout) Expire (completely remove) a group if it is completed due to timeout.expireTimeout
(long expireTimeout) Configure a timeout for old groups in the store to purge.forceReleaseAdvice
(Advice... advice) Configure a list ofAdvice
objects to be applied to theforceComplete()
operation.groupConditionSupplier
(BiFunction<Message<?>, String, String> conditionSupplier) Configure aBiFunction
to supply a group condition from a message to be added to the group.groupTimeout
(long groupTimeout) Configure the handler with a group timeout expression that evaluates to this constant value.groupTimeout
(Function<MessageGroup, ?> groupTimeoutFunction) Configure the handler with a function that will be invoked to resolve the group timeout, based on the message group.groupTimeoutExpression
(String groupTimeoutExpression) Specify a SpEL expression to evaluate the group timeout for scheduled expiration.lockRegistry
(LockRegistry lockRegistry) Used to obtain aLock
based on thegroupId
for concurrent operations on theMessageGroup
.messageStore
(MessageGroupStore messageStore) minimumTimeoutForEmptyGroups
(long minimumTimeoutForEmptyGroups) popSequence
(boolean popSequence) Perform aMessageBuilder.popSequenceDetails()
for output message or not.Configure the handler withMethodInvokingCorrelationStrategy
andMethodInvokingReleaseStrategy
using the target object which should have methods annotated appropriately for each function.releaseExpression
(String releaseExpression) Configure the handler with anExpressionEvaluatingReleaseStrategy
for the given expression.releaseLockBeforeSend
(boolean releaseLockBeforeSend) Set to true to release the message group lock before sending any output.releaseStrategy
(Object target, String methodName) Configure the handler with anMethodInvokingReleaseStrategy
for the target object and method name.releaseStrategy
(ReleaseStrategy releaseStrategy) sendPartialResultOnExpiry
(boolean sendPartialResultOnExpiry) taskScheduler
(TaskScheduler taskScheduler) Configure aTaskScheduler
for scheduling tasks, for example in the Polling Consumer.Methods inherited from class org.springframework.integration.dsl.ConsumerEndpointSpec
advice, async, autoStartup, customizeMonoReply, doGet, handleMessageAdvice, notPropagatedHeaders, order, phase, poller, reactive, reactive, requiresReply, role, sendTimeout, transactional, transactional, transactional, transactional, transactional
Methods inherited from class org.springframework.integration.dsl.EndpointSpec
assertHandler, getComponentsToRegister, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, poller
Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
CorrelationHandlerSpec
-
-
Method Details
-
messageStore
- Parameters:
messageStore
- the message group store.- Returns:
- the handler spec.
- See Also:
-
sendPartialResultOnExpiry
- Parameters:
sendPartialResultOnExpiry
- the sendPartialResultOnExpiry.- Returns:
- the handler spec.
- See Also:
-
minimumTimeoutForEmptyGroups
- Parameters:
minimumTimeoutForEmptyGroups
- the minimumTimeoutForEmptyGroups- Returns:
- the handler spec.
- See Also:
-
groupTimeout
Configure the handler with a group timeout expression that evaluates to this constant value.- Parameters:
groupTimeout
- the group timeout in milliseconds.- Returns:
- the handler spec.
- See Also:
-
groupTimeoutExpression
Specify a SpEL expression to evaluate the group timeout for scheduled expiration. Must returnDate
,Long
orString
as a long.- Parameters:
groupTimeoutExpression
- the group timeout expression string.- Returns:
- the handler spec.
- See Also:
-
groupTimeout
Configure the handler with a function that will be invoked to resolve the group timeout, based on the message group. Usually used with a JDK8 lambda:.groupTimeout(g -> g.size() * 2000L)
. Must returnDate
,Long
orString
a long.- Parameters:
groupTimeoutFunction
- a function invoked to resolve the group timeout in milliseconds.- Returns:
- the handler spec.
- See Also:
-
taskScheduler
Description copied from class:ConsumerEndpointSpec
Configure aTaskScheduler
for scheduling tasks, for example in the Polling Consumer. By default the globalThreadPoolTaskScheduler
bean is used. This configuration is useful when there are requirements to dedicate particular threads for polling task, for example.- Overrides:
taskScheduler
in classConsumerEndpointSpec<S extends CorrelationHandlerSpec<S,
H>, H extends AbstractCorrelatingMessageHandler> - Parameters:
taskScheduler
- the task scheduler.- Returns:
- the handler spec.
- See Also:
-
discardChannel
- Parameters:
discardChannel
- the discard channel.- Returns:
- the handler spec.
- See Also:
-
discardChannel
- Parameters:
discardChannelName
- the discard channel.- Returns:
- the handler spec.
- See Also:
-
processor
Configure the handler withMethodInvokingCorrelationStrategy
andMethodInvokingReleaseStrategy
using the target object which should have methods annotated appropriately for each function.- Parameters:
target
- the target object- Returns:
- the handler spec.
- See Also:
-
correlationExpression
Configure the handler with anExpressionEvaluatingCorrelationStrategy
for the given expression.- Parameters:
correlationExpression
- the correlation expression.- Returns:
- the handler spec.
- See Also:
-
correlationStrategy
Configure the handler with anMethodInvokingCorrelationStrategy
for the target object and method name.- Parameters:
target
- the target object.methodName
- the method name.- Returns:
- the handler spec.
- See Also:
-
correlationStrategy
- Parameters:
correlationStrategy
- the correlation strategy.- Returns:
- the handler spec.
- See Also:
-
releaseExpression
Configure the handler with anExpressionEvaluatingReleaseStrategy
for the given expression.- Parameters:
releaseExpression
- the correlation expression.- Returns:
- the handler spec.
- See Also:
-
releaseStrategy
Configure the handler with anMethodInvokingReleaseStrategy
for the target object and method name.- Parameters:
target
- the target object.methodName
- the method name.- Returns:
- the handler spec.
- See Also:
-
releaseStrategy
- Parameters:
releaseStrategy
- the release strategy.- Returns:
- the handler spec.
- See Also:
-
expireGroupsUponTimeout
Expire (completely remove) a group if it is completed due to timeout. Defaulttrue
for aggregator andfalse
for resequencer.- Parameters:
expireGroupsUponTimeout
- the expireGroupsUponTimeout to set- Returns:
- the handler spec.
- See Also:
-
forceReleaseAdvice
Configure a list ofAdvice
objects to be applied to theforceComplete()
operation.- Parameters:
advice
- the advice chain.- Returns:
- the endpoint spec.
-
lockRegistry
Used to obtain aLock
based on thegroupId
for concurrent operations on theMessageGroup
. By default, an internalDefaultLockRegistry
is used. Use of a distributedLockRegistry
, such as theRedisLockRegistry
, ensures only one instance of the aggregator will operate on a group concurrently.- Parameters:
lockRegistry
- theLockRegistry
to use.- Returns:
- the endpoint spec.
-
popSequence
Perform aMessageBuilder.popSequenceDetails()
for output message or not.- Parameters:
popSequence
- the boolean flag to use.- Returns:
- the endpoint spec.
- Since:
- 5.1
- See Also:
-
expireTimeout
Configure a timeout for old groups in the store to purge.- Parameters:
expireTimeout
- the timeout in milliseconds to use.- Returns:
- the endpoint spec.
- Since:
- 5.5
- See Also:
-
expireDuration
Configure aDuration
how often to run a scheduled purge task.- Parameters:
expireDuration
- the duration for scheduled purge task.- Returns:
- the endpoint spec.
- Since:
- 5.5
- See Also:
-
releaseLockBeforeSend
Set to true to release the message group lock before sending any output. See "Avoiding Deadlocks" in the Aggregator section of the reference manual for more information as to why this might be needed.- Parameters:
releaseLockBeforeSend
- true to release the lock.- Returns:
- the endpoint spec.
- Since:
- 5.5
- See Also:
-
groupConditionSupplier
Configure aBiFunction
to supply a group condition from a message to be added to the group. Thenull
result from the function will reset a condition set before.- Parameters:
conditionSupplier
- the function to supply a group condition from a message to be added to the group.- Returns:
- the endpoint spec.
- Since:
- 5.5
-