org.springframework.integration.handler
Class ReplyMessageCorrelator

java.lang.Object
  extended by org.springframework.integration.handler.ReplyMessageCorrelator
All Implemented Interfaces:
MessageHandler

public class ReplyMessageCorrelator
extends java.lang.Object
implements MessageHandler

A handler for receiving messages from a "reply channel". Any component that is expecting a reply message can poll by providing the correlation identifier.

Author:
Mark Fisher

Field Summary
private  long defaultTimeout
           
private  RetrievalBlockingMessageStore messageStore
           
 
Constructor Summary
ReplyMessageCorrelator(int capacity)
           
 
Method Summary
protected  java.lang.Object getCorrelationId(Message<?> message)
          Retrieve the correlation identifier from the provided message.
 Message<?> getReply(java.lang.Object correlationId)
           
 Message<?> getReply(java.lang.Object correlationId, long timeout)
           
 Message<?> handle(Message<?> message)
           
 void setDefaultTimeout(long defaultTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTimeout

private volatile long defaultTimeout

messageStore

private final RetrievalBlockingMessageStore messageStore
Constructor Detail

ReplyMessageCorrelator

public ReplyMessageCorrelator(int capacity)
Method Detail

setDefaultTimeout

public void setDefaultTimeout(long defaultTimeout)

handle

public Message<?> handle(Message<?> message)
Specified by:
handle in interface MessageHandler

getReply

public Message<?> getReply(java.lang.Object correlationId)

getReply

public Message<?> getReply(java.lang.Object correlationId,
                           long timeout)

getCorrelationId

protected java.lang.Object getCorrelationId(Message<?> message)
Retrieve the correlation identifier from the provided message.

This method may be overridden by subclasses. The default implementation returns the 'correlationId' from the message header.