org.springframework.integration.aggregator
Class CorrelatingMessageHandler

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.aggregator.CorrelatingMessageHandler
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, NamedComponent, Orderable, MessageHandler, MessageProducer, TrackableComponent

public class CorrelatingMessageHandler
extends AbstractMessageHandler
implements MessageProducer

Message handler that holds a buffer of correlated messages in a MessageStore. This class takes care of correlated groups of messages that can be completed in batches. It is useful for aggregating, resequencing, or custom implementations requiring correlation.

To customize this handler inject CorrelationStrategy, ReleaseStrategy, and MessageGroupProcessor implementations as you require.

By default the CorrelationStrategy will be a HeaderAttributeCorrelationStrategy and the ReleaseStrategy will be a SequenceSizeReleaseStrategy.

Since:
2.0

Field Summary
static long DEFAULT_SEND_TIMEOUT
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
CorrelatingMessageHandler(MessageGroupProcessor processor)
           
CorrelatingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store)
           
CorrelatingMessageHandler(MessageGroupProcessor processor, MessageGroupStore store, CorrelationStrategy correlationStrategy, ReleaseStrategy releaseStrategy)
           
 
Method Summary
 java.lang.String getComponentType()
          Subclasses may implement this method to provide component type information.
protected  void handleMessageInternal(Message<?> message)
           
protected  void onInit()
          Subclasses may implement this for initialization logic.
 void setCorrelationStrategy(CorrelationStrategy correlationStrategy)
           
 void setDiscardChannel(MessageChannel discardChannel)
           
 void setLockRegistry(LockRegistry lockRegistry)
           
 void setMessageStore(MessageGroupStore store)
           
 void setOutputChannel(MessageChannel outputChannel)
          Specify the MessageChannel to which produced Messages should be sent.
 void setReleasePartialSequences(boolean releasePartialSequences)
           
 void setReleaseStrategy(ReleaseStrategy releaseStrategy)
           
 void setSendPartialResultOnExpiry(boolean sendPartialResultOnExpiry)
           
 void setSendTimeout(long sendTimeout)
           
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, 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
getComponentName
 

Field Detail

DEFAULT_SEND_TIMEOUT

public static final long DEFAULT_SEND_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

CorrelatingMessageHandler

public CorrelatingMessageHandler(MessageGroupProcessor processor,
                                 MessageGroupStore store,
                                 CorrelationStrategy correlationStrategy,
                                 ReleaseStrategy releaseStrategy)

CorrelatingMessageHandler

public CorrelatingMessageHandler(MessageGroupProcessor processor,
                                 MessageGroupStore store)

CorrelatingMessageHandler

public CorrelatingMessageHandler(MessageGroupProcessor processor)
Method Detail

setLockRegistry

public void setLockRegistry(LockRegistry lockRegistry)

setMessageStore

public void setMessageStore(MessageGroupStore store)

setCorrelationStrategy

public void setCorrelationStrategy(CorrelationStrategy correlationStrategy)

setReleaseStrategy

public void setReleaseStrategy(ReleaseStrategy releaseStrategy)

setOutputChannel

public void setOutputChannel(MessageChannel outputChannel)
Description copied from interface: MessageProducer
Specify the MessageChannel to which produced Messages should be sent.

Specified by:
setOutputChannel in interface MessageProducer

onInit

protected void onInit()
               throws java.lang.Exception
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class IntegrationObjectSupport
Throws:
java.lang.Exception

setDiscardChannel

public void setDiscardChannel(MessageChannel discardChannel)

setSendTimeout

public void setSendTimeout(long sendTimeout)

setSendPartialResultOnExpiry

public void setSendPartialResultOnExpiry(boolean sendPartialResultOnExpiry)

setReleasePartialSequences

public void setReleasePartialSequences(boolean releasePartialSequences)

getComponentType

public java.lang.String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class AbstractMessageHandler

handleMessageInternal

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