org.springframework.integration.aggregator
Class Resequencer

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandler
      extended by org.springframework.integration.aggregator.AbstractMessageBarrierHandler
          extended by org.springframework.integration.aggregator.Resequencer
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, MessageHandler, TaskSchedulerAware

public class Resequencer
extends AbstractMessageBarrierHandler

An AbstractMessageBarrierHandler that waits for a group of Messages to arrive and re-sends them in order, sorted by their sequenceNumber.

This handler can either release partial sequences of messages or can wait for the whole sequence to arrive before re-sending them.

All considerations regarding timeout and grouping by 'correlationId' from AbstractMessageBarrierHandler apply here as well.

Author:
Marius Bogoevici

Field Summary
 
Fields inherited from class org.springframework.integration.aggregator.AbstractMessageBarrierHandler
barriers, DEFAULT_REAPER_INTERVAL, DEFAULT_SEND_TIMEOUT, DEFAULT_TIMEOUT, DEFAULT_TRACKED_CORRRELATION_ID_CAPACITY, logger, trackedCorrelationIds
 
Constructor Summary
Resequencer()
           
 
Method Summary
protected  MessageBarrier createMessageBarrier()
          Factory method for creating a suitable MessageBarrier implementation.
protected  boolean isBarrierRemovable(java.lang.Object correlationId, java.util.List<Message<?>> releasedMessages)
          Implements the logic for deciding whether, based on what the MessageBarrier has released so far, work for the correlationId can be considered complete and the barrier can be released.
protected  Message<?>[] processReleasedMessages(java.lang.Object correlationId, java.util.List<Message<?>> messages)
          Implements the logic for transforming the released Messages.
 void setReleasePartialSequences(boolean releasePartialSequences)
           
 
Methods inherited from class org.springframework.integration.aggregator.AbstractMessageBarrierHandler
afterPropertiesSet, handleMessageInternal, isRunning, resolveReplyChannelFromMessage, setDiscardChannel, setOutputChannel, setReaperInterval, setSendPartialResultOnTimeout, setSendTimeout, setTaskScheduler, setTimeout, setTrackedCorrelationIdCapacity, start, stop
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resequencer

public Resequencer()
Method Detail

setReleasePartialSequences

public void setReleasePartialSequences(boolean releasePartialSequences)

createMessageBarrier

protected MessageBarrier createMessageBarrier()
Description copied from class: AbstractMessageBarrierHandler
Factory method for creating a suitable MessageBarrier implementation.

Specified by:
createMessageBarrier in class AbstractMessageBarrierHandler

processReleasedMessages

protected Message<?>[] processReleasedMessages(java.lang.Object correlationId,
                                               java.util.List<Message<?>> messages)
Description copied from class: AbstractMessageBarrierHandler
Implements the logic for transforming the released Messages.

Specified by:
processReleasedMessages in class AbstractMessageBarrierHandler

isBarrierRemovable

protected boolean isBarrierRemovable(java.lang.Object correlationId,
                                     java.util.List<Message<?>> releasedMessages)
Description copied from class: AbstractMessageBarrierHandler
Implements the logic for deciding whether, based on what the MessageBarrier has released so far, work for the correlationId can be considered complete and the barrier can be released.

Specified by:
isBarrierRemovable in class AbstractMessageBarrierHandler