Class ResequencingMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler
org.springframework.integration.aggregator.ResequencingMessageHandler
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>
,Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,ApplicationEventPublisherAware
,Lifecycle
,Ordered
,ExpressionCapable
,Orderable
,MessageProducer
,DiscardingMessageHandler
,HeaderPropagationAware
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,ManageableLifecycle
,TrackableComponent
,MessageHandler
,reactor.core.CoreSubscriber<Message<?>>
Resequencer specific implementation of
AbstractCorrelatingMessageHandler
.
Will remove MessageGroup
s only if 'sequenceSize' is provided and reached.- Since:
- 2.1
- Author:
- Oleg Zhurakousky, Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler
AbstractCorrelatingMessageHandler.SequenceAwareMessageGroup
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplate
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionResequencingMessageHandler
(MessageGroupProcessor processor) ResequencingMessageHandler
(MessageGroupProcessor processor, MessageGroupStore store) ResequencingMessageHandler
(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterRelease
(MessageGroup messageGroup, Collection<Message<?>> completedMessages) Allows you to provide additional logic that needs to be performed after the MessageGroup was released.protected void
afterRelease
(MessageGroup messageGroup, Collection<Message<?>> completedMessages, boolean timeout) Perform group removal if itssize
is equal to thesequenceSize
.Subclasses may implement this method to provide component type information.Return a pattern type this component implements.final void
setExpireGroupsUponTimeout
(boolean expireGroupsUponTimeout) Overridden to false for a resequencer so late messages are immediately discarded rather than waiting for the next timeout.protected boolean
Subclasses may override this.Methods inherited from class org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler
completeGroup, completeGroup, destroy, expireGroup, findLastReleasedSequenceNumber, forceComplete, getCorrelationStrategy, getDiscardChannel, getDiscardChannelName, getEvaluationContext, getExpireGroupScheduledFutures, getGroupConditionSupplier, getGroupTimeoutExpression, getLockRegistry, getMessageStore, getMinimumTimeoutForEmptyGroups, getOutputProcessor, getReleaseStrategy, handleMessageInternal, isExpireGroupsUponCompletion, isLockRegistrySet, isReleaseLockBeforeSend, isReleasePartialSequences, isRunning, isSendPartialResultOnExpiry, isSequenceAware, obtainGroupTimeout, onInit, purgeOrphanedGroups, remove, setApplicationEventPublisher, setCorrelationStrategy, setDiscardChannel, setDiscardChannelName, setExpireDuration, setExpireDurationMillis, setExpireTimeout, setForceReleaseAdviceChain, setGroupConditionSupplier, setGroupTimeoutExpression, setLockRegistry, setMessageStore, setMinimumTimeoutForEmptyGroups, setOutputProcessor, setPopSequence, setReleaseLockBeforeSend, setReleasePartialSequences, setReleaseStrategy, setSendPartialResultOnExpiry, start, stop, store, verifyResultCollectionConsistsOfMessages
Methods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldSplitOutput, updateNotPropagatedHeaders
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface reactor.core.CoreSubscriber
currentContext
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.messaging.MessageHandler
handleMessage
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
ResequencingMessageHandler
public ResequencingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) -
ResequencingMessageHandler
-
ResequencingMessageHandler
-
-
Method Details
-
setExpireGroupsUponTimeout
public final void setExpireGroupsUponTimeout(boolean expireGroupsUponTimeout) Overridden to false for a resequencer so late messages are immediately discarded rather than waiting for the next timeout.- Overrides:
setExpireGroupsUponTimeout
in classAbstractCorrelatingMessageHandler
- Parameters:
expireGroupsUponTimeout
- the expireGroupsUponTimeout to set
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classAbstractCorrelatingMessageHandler
-
getIntegrationPatternType
Description copied from interface:IntegrationPattern
Return a pattern type this component implements.- Specified by:
getIntegrationPatternType
in interfaceIntegrationPattern
- Overrides:
getIntegrationPatternType
in classMessageHandlerSupport
- Returns:
- the
IntegrationPatternType
this component implements.
-
shouldCopyRequestHeaders
protected boolean shouldCopyRequestHeaders()Description copied from class:AbstractMessageProducingHandler
Subclasses may override this. True by default.- Overrides:
shouldCopyRequestHeaders
in classAbstractMessageProducingHandler
- Returns:
- true if the request headers should be copied.
-
afterRelease
Description copied from class:AbstractCorrelatingMessageHandler
Allows you to provide additional logic that needs to be performed after the MessageGroup was released.- Specified by:
afterRelease
in classAbstractCorrelatingMessageHandler
- Parameters:
messageGroup
- The group.completedMessages
- The completed messages.
-
afterRelease
protected void afterRelease(MessageGroup messageGroup, Collection<Message<?>> completedMessages, boolean timeout) Perform group removal if itssize
is equal to thesequenceSize
. RemovecompletedMessages
from the group if it isn't null.- Overrides:
afterRelease
in classAbstractCorrelatingMessageHandler
- Parameters:
messageGroup
- the group to clean up.completedMessages
- The completed messages.timeout
- True if the release/discard was due to a timeout.
-