org.springframework.integration.handler
Class DefaultMessageHandler

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandler
      extended by org.springframework.integration.handler.DefaultMessageHandler
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, MessageHandler

public class DefaultMessageHandler
extends AbstractMessageHandler

The default MessageHandler implementation. Creates a Message for the reply payload. The request Message's headers are copied and the request Message's ID is set as this reply Message's correlationId.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
DefaultMessageHandler()
           
 
Method Summary
protected  Message<?> createReplyMessage(java.lang.Object result, Message<?> requestMessage)
          Subclasses must implement this method to generate the reply Message when the return value is not a Message instance.
protected  Message<?> postProcessReplyMessage(Message<?> replyMessage, Message<?> requestMessage)
          Subclasses must implement this method to process a return value that is already a Message instance.
private  Message<?> prepareReplyMessage(MessageBuilder<?> builder, MessageHeaders requestHeaders)
           
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
afterPropertiesSet, getOrder, handle, setMethod, setMethodName, setObject, setOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageHandler

public DefaultMessageHandler()
Method Detail

createReplyMessage

protected Message<?> createReplyMessage(java.lang.Object result,
                                        Message<?> requestMessage)
Description copied from class: AbstractMessageHandler
Subclasses must implement this method to generate the reply Message when the return value is not a Message instance.

Specified by:
createReplyMessage in class AbstractMessageHandler
Parameters:
result - the return value from an adapter method, or the Message payload if not acting as an adapter
requestMessage - the original request Message
Returns:
the Message to be sent to the reply MessageTarget

postProcessReplyMessage

protected Message<?> postProcessReplyMessage(Message<?> replyMessage,
                                             Message<?> requestMessage)
Description copied from class: AbstractMessageHandler
Subclasses must implement this method to process a return value that is already a Message instance.

Specified by:
postProcessReplyMessage in class AbstractMessageHandler
Parameters:
replyMessage - the Message returned from an adapter method
requestMessage - the original request Message
Returns:
the Message to be sent to the reply MessageTarget

prepareReplyMessage

private Message<?> prepareReplyMessage(MessageBuilder<?> builder,
                                       MessageHeaders requestHeaders)