Class AggregatingMessageHandler
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.AggregatingMessageHandler
- 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<?>>
Aggregator specific implementation of
AbstractCorrelatingMessageHandler
.
Will remove MessageGroup
s in the afterRelease(org.springframework.integration.store.MessageGroup, java.util.Collection<org.springframework.messaging.Message<?>>)
only if 'expireGroupsUponCompletion' flag is set to 'true'.- Since:
- 2.1
- Author:
- Oleg Zhurakousky, Artem Bilan, Gary Russell
-
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
ConstructorDescriptionAggregatingMessageHandler
(MessageGroupProcessor processor) AggregatingMessageHandler
(MessageGroupProcessor processor, MessageGroupStore store) AggregatingMessageHandler
(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterRelease
(MessageGroup messageGroup, Collection<Message<?>> completedMessages) Complete the group and remove all its messages.Return a pattern type this component implements.protected boolean
void
setExpireGroupsUponCompletion
(boolean expireGroupsUponCompletion) Will set the 'expireGroupsUponCompletion' flag.protected boolean
shouldSplitOutput
(Iterable<?> reply) Check anIterable
result for split possibility on the output production: the items of the collection have to be instances ofMessage
orAbstractIntegrationMessageBuilder
andAbstractCorrelatingMessageHandler.getOutputProcessor()
has to be aSimpleMessageGroupProcessor
.Methods inherited from class org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler
afterRelease, completeGroup, completeGroup, destroy, expireGroup, findLastReleasedSequenceNumber, forceComplete, getComponentType, getCorrelationStrategy, getDiscardChannel, getDiscardChannelName, getEvaluationContext, getExpireGroupScheduledFutures, getGroupConditionSupplier, getGroupTimeoutExpression, getLockRegistry, getMessageStore, getMinimumTimeoutForEmptyGroups, getOutputProcessor, getReleaseStrategy, handleMessageInternal, isLockRegistrySet, isReleaseLockBeforeSend, isReleasePartialSequences, isRunning, isSendPartialResultOnExpiry, isSequenceAware, obtainGroupTimeout, onInit, purgeOrphanedGroups, remove, setApplicationEventPublisher, setCorrelationStrategy, setDiscardChannel, setDiscardChannelName, setExpireDuration, setExpireDurationMillis, setExpireGroupsUponTimeout, 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, shouldCopyRequestHeaders, 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
-
AggregatingMessageHandler
public AggregatingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy) -
AggregatingMessageHandler
-
AggregatingMessageHandler
-
-
Method Details
-
setExpireGroupsUponCompletion
public void setExpireGroupsUponCompletion(boolean expireGroupsUponCompletion) Will set the 'expireGroupsUponCompletion' flag.- Parameters:
expireGroupsUponCompletion
- true when groups should be expired on completion.- See Also:
-
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.
-
isExpireGroupsUponCompletion
protected boolean isExpireGroupsUponCompletion()- Overrides:
isExpireGroupsUponCompletion
in classAbstractCorrelatingMessageHandler
-
shouldSplitOutput
Check anIterable
result for split possibility on the output production: the items of the collection have to be instances ofMessage
orAbstractIntegrationMessageBuilder
andAbstractCorrelatingMessageHandler.getOutputProcessor()
has to be aSimpleMessageGroupProcessor
. Otherwise, a single reply message is emitted with the wholeIterable
as its payload.- Overrides:
shouldSplitOutput
in classAbstractMessageProducingHandler
- Parameters:
reply
- theIterable
result to check for split possibility.- Returns:
- true if the
Iterable
result has to be split into individual messages. - Since:
- 6.0
-
afterRelease
Complete the group and remove all its messages. If theexpireGroupsUponCompletion
is true, then remove group fully.- Specified by:
afterRelease
in classAbstractCorrelatingMessageHandler
- Parameters:
messageGroup
- the group to clean up.completedMessages
- The completed messages. Ignored in this implementation.
-