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 targetCorrelationHandlerSpecimplementation type.H- theAbstractCorrelatingMessageHandlerimplementation 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
adviceChainFields inherited from class org.springframework.integration.dsl.EndpointSpec
componentsToRegister, endpointFactoryBean, handlerFields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, targetFields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
loggerFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncorrelationExpression(String correlationExpression) Configure the handler with anExpressionEvaluatingCorrelationStrategyfor the given expression.correlationStrategy(Object target, String methodName) Configure the handler with anMethodInvokingCorrelationStrategyfor the target object and method name.correlationStrategy(CorrelationStrategy correlationStrategy) discardChannel(String discardChannelName) discardChannel(MessageChannel discardChannel) expireDuration(Duration expireDuration) Configure aDurationhow 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 ofAdviceobjects to be applied to theforceComplete()operation.groupConditionSupplier(BiFunction<Message<?>, String, String> conditionSupplier) Configure aBiFunctionto 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 aLockbased on thegroupIdfor concurrent operations on theMessageGroup.messageStore(MessageGroupStore messageStore) minimumTimeoutForEmptyGroups(long minimumTimeoutForEmptyGroups) popSequence(boolean popSequence) Perform aMessageBuilder.popSequenceDetails()for output message or not.Configure the handler withMethodInvokingCorrelationStrategyandMethodInvokingReleaseStrategyusing the target object which should have methods annotated appropriately for each function.releaseExpression(String releaseExpression) Configure the handler with anExpressionEvaluatingReleaseStrategyfor 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 anMethodInvokingReleaseStrategyfor the target object and method name.releaseStrategy(ReleaseStrategy releaseStrategy) sendPartialResultOnExpiry(boolean sendPartialResultOnExpiry) setExpireDuration(Duration expireDuration) Deprecated.setExpireTimeout(long expireTimeout) Deprecated.since 5.5 in favor ofexpireTimeout(long)taskScheduler(TaskScheduler taskScheduler) Configure aTaskSchedulerfor 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, transactionalMethods inherited from class org.springframework.integration.dsl.EndpointSpec
assertHandler, getComponentsToRegister, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, pollerMethods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stopMethods 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,LongorStringas 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,LongorStringa long.- Parameters:
groupTimeoutFunction- a function invoked to resolve the group timeout in milliseconds.- Returns:
- the handler spec.
- See Also:
-
taskScheduler
Description copied from class:ConsumerEndpointSpecConfigure aTaskSchedulerfor scheduling tasks, for example in the Polling Consumer. By default the globalThreadPoolTaskSchedulerbean is used. This configuration is useful when there are requirements to dedicate particular threads for polling task, for example.- Overrides:
taskSchedulerin 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 withMethodInvokingCorrelationStrategyandMethodInvokingReleaseStrategyusing 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 anExpressionEvaluatingCorrelationStrategyfor the given expression.- Parameters:
correlationExpression- the correlation expression.- Returns:
- the handler spec.
- See Also:
-
correlationStrategy
Configure the handler with anMethodInvokingCorrelationStrategyfor 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 anExpressionEvaluatingReleaseStrategyfor the given expression.- Parameters:
releaseExpression- the correlation expression.- Returns:
- the handler spec.
- See Also:
-
releaseStrategy
Configure the handler with anMethodInvokingReleaseStrategyfor 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. Defaulttruefor aggregator andfalsefor resequencer.- Parameters:
expireGroupsUponTimeout- the expireGroupsUponTimeout to set- Returns:
- the handler spec.
- See Also:
-
forceReleaseAdvice
Configure a list ofAdviceobjects to be applied to theforceComplete()operation.- Parameters:
advice- the advice chain.- Returns:
- the endpoint spec.
-
lockRegistry
Used to obtain aLockbased on thegroupIdfor concurrent operations on theMessageGroup. By default, an internalDefaultLockRegistryis used. Use of a distributedLockRegistry, such as theRedisLockRegistry, ensures only one instance of the aggregator will operate on a group concurrently.- Parameters:
lockRegistry- theLockRegistryto 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:
-
setExpireTimeout
Deprecated.since 5.5 in favor ofexpireTimeout(long)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.4
- 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:
-
setExpireDuration
Deprecated.since 5.5 in favor ofexpireDuration(Duration)Configure aDurationhow often to run a scheduled purge task.- Parameters:
expireDuration- the duration for scheduled purge task.- Returns:
- the endpoint spec.
- Since:
- 5.4
- See Also:
-
expireDuration
Configure aDurationhow 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 aBiFunctionto supply a group condition from a message to be added to the group. Thenullresult 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
-
expireDuration(Duration)