Class CorrelatingMessageBarrier
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.aggregator.CorrelatingMessageBarrier
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>
,Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Ordered
,ComponentSourceAware
,ExpressionCapable
,Orderable
,MessageSource<Object>
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,TrackableComponent
,MessageHandler
,reactor.core.CoreSubscriber<Message<?>>
public class CorrelatingMessageBarrier
extends AbstractMessageHandler
implements MessageSource<Object>
This Endpoint serves as a barrier for messages that should not be processed yet. The decision when a message can be
processed is delegated to a
ReleaseStrategy
.
When a message can be processed it is up to the client to take care of the locking (potentially from the
ReleaseStrategy's
canRelease(..)
method).
This class differs from AbstractCorrelatingMessageHandler in that it completely decouples the receiver and the sender. It can be applied in scenarios where completion of a message group is not well defined but only a certain amount of messages for any given correlation key may be processed at a time.
The messages will be stored in a MessageStore
for each correlation key.
- Author:
- Iwein Fuld, Oleg Zhurakousky, Gary Russell, Artem Bilan, Trung Pham
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
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
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprotected void
handleMessageInternal
(Message<?> message) receive()
Retrieve the next available message from this source.void
setCorrelationStrategy
(CorrelationStrategy correlationStrategy) Set the CorrelationStrategy to be used to determine the correlation key for incoming messages.void
setReleaseStrategy
(ReleaseStrategy releaseStrategy) Set the ReleaseStrategy that should be used when deciding if a group in this barrier may be released.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, destroy, getComponentType, getIntegrationPatternType, 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, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, 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.integration.core.MessageSource
getIntegrationPatternType
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
CorrelatingMessageBarrier
public CorrelatingMessageBarrier() -
CorrelatingMessageBarrier
-
-
Method Details
-
setCorrelationStrategy
Set the CorrelationStrategy to be used to determine the correlation key for incoming messages.- Parameters:
correlationStrategy
- The correlation strategy.
-
setReleaseStrategy
Set the ReleaseStrategy that should be used when deciding if a group in this barrier may be released.- Parameters:
releaseStrategy
- The release strategy.
-
handleMessageInternal
- Specified by:
handleMessageInternal
in classAbstractMessageHandler
-
receive
Description copied from interface:MessageSource
Retrieve the next available message from this source. Returnsnull
if no message is available.- Specified by:
receive
in interfaceMessageSource<Object>
- Returns:
- The message or null.
-