Class CorrelatingMessageBarrier

  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.aggregator.CorrelatingMessageBarrier
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, Orderable, MessageHandler, MessageSource<java.lang.Object>, TrackableComponent

public class CorrelatingMessageBarrier
extends AbstractMessageHandler
implements MessageSource<java.lang.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.

See Also:

Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
Fields inherited from interface org.springframework.core.Ordered
Constructor Summary
CorrelatingMessageBarrier(MessageGroupStore store)
Method Summary
protected  void handleMessageInternal(Message<?> message)
 Message<java.lang.Object> 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
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.context.NamedComponent

Constructor Detail


public CorrelatingMessageBarrier(MessageGroupStore store)


public CorrelatingMessageBarrier()
Method Detail


public void setCorrelationStrategy(CorrelationStrategy correlationStrategy)
Set the CorrelationStrategy to be used to determine the correlation key for incoming messages


public void setReleaseStrategy(ReleaseStrategy releaseStrategy)
Set the ReleaseStrategy that should be used when deciding if a group in this barrier may be released.


protected void handleMessageInternal(Message<?> message)
                              throws java.lang.Exception
Specified by:
handleMessageInternal in class AbstractMessageHandler


public Message<java.lang.Object> receive()
Description copied from interface: MessageSource
Retrieve the next available message from this source. Returns null if no message is available.

Specified by:
receive in interface MessageSource<java.lang.Object>