org.springframework.integration.aggregator
Class ResequencingMessageHandler

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

public class ResequencingMessageHandler
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
private  boolean releasePartialSequences
           
 
Fields inherited from class org.springframework.integration.aggregator.AbstractMessageBarrierHandler
barriers, DEFAULT_REAPER_INTERVAL, DEFAULT_SEND_TIMEOUT, DEFAULT_TIMEOUT, DEFAULT_TRACKED_CORRRELATION_ID_CAPACITY, executor, logger, outputChannel, sendTimeout, trackedCorrelationIds
 
Constructor Summary
ResequencingMessageHandler()
           
ResequencingMessageHandler(java.util.concurrent.ScheduledExecutorService executor)
           
 
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 done 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, handle, resolveReplyTargetFromMessage, setDiscardChannel, setOutputChannel, setReaperInterval, setSendPartialResultOnTimeout, setSendTimeout, setTimeout, setTrackedCorrelationIdCapacity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

releasePartialSequences

private volatile boolean releasePartialSequences
Constructor Detail

ResequencingMessageHandler

public ResequencingMessageHandler()

ResequencingMessageHandler

public ResequencingMessageHandler(java.util.concurrent.ScheduledExecutorService executor)
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 done and the barrier can be released.

Specified by:
isBarrierRemovable in class AbstractMessageBarrierHandler