Spring Integration

org.springframework.integration.handler
Class AbstractReplyProducingMessageHandler

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.handler.AbstractReplyProducingMessageHandler
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, MessageHandler, MessageProducer, NamedComponent
Direct Known Subclasses:
AbstractMessageSplitter, AbstractRemotingOutboundGateway, AbstractWebServiceOutboundGateway, BridgeHandler, FileWritingMessageHandler, HttpRequestExecutingMessageHandler, JmsOutboundGateway, MessageFilter, MessageTransformingHandler, OperationInvokingMessageHandler, ServiceActivatingHandler, SimpleTcpNetOutboundGateway

public abstract class AbstractReplyProducingMessageHandler
extends AbstractMessageHandler
implements MessageProducer

Base class for MessageHandlers that are capable of producing replies.

Author:
Mark Fisher, Iwein Fuld, Oleg Zhurakousky

Field Summary
static long DEFAULT_SEND_TIMEOUT
           
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AbstractReplyProducingMessageHandler()
           
 
Method Summary
protected  MessageChannel getOutputChannel()
           
protected  void handleMessageInternal(Message<?> message)
          
protected abstract  Object handleRequestMessage(Message<?> requestMessage)
          Subclasses must implement this method to handle the request Message.
protected  void handleResult(Object result, MessageHeaders requestHeaders, MessageChannel replyChannel)
           
protected  boolean sendReplyMessage(Message<?> replyMessage, MessageChannel replyChannel)
           
 void setChannelResolver(ChannelResolver channelResolver)
          Set the ChannelResolver to be used when there is no default output channel.
 void setOutputChannel(MessageChannel outputChannel)
          Specify the MessageChannel to which produced Messages should be sent.
 void setRequiresReply(boolean requiresReply)
          Flag wether reply is required.
 void setSendTimeout(long sendTimeout)
          Set the timeout for sending reply Messages.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getComponentType, getOrder, handleMessage, resolveReplyChannel, setOrder
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString, writeMessageHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SEND_TIMEOUT

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

AbstractReplyProducingMessageHandler

public AbstractReplyProducingMessageHandler()
Method Detail

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

getOutputChannel

protected MessageChannel getOutputChannel()

setSendTimeout

public void setSendTimeout(long sendTimeout)
Set the timeout for sending reply Messages.


setChannelResolver

public void setChannelResolver(ChannelResolver channelResolver)
Set the ChannelResolver to be used when there is no default output channel.

Overrides:
setChannelResolver in class IntegrationObjectSupport

setRequiresReply

public void setRequiresReply(boolean requiresReply)
Flag wether reply is required. If true an incoming message MUST result in a reply message being sent. If false an incoming message MAY result in a reply message being sent


handleMessageInternal

protected final void handleMessageInternal(Message<?> message)

Specified by:
handleMessageInternal in class AbstractMessageHandler

handleResult

protected void handleResult(Object result,
                            MessageHeaders requestHeaders,
                            MessageChannel replyChannel)

sendReplyMessage

protected boolean sendReplyMessage(Message<?> replyMessage,
                                   MessageChannel replyChannel)

handleRequestMessage

protected abstract Object handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.


Spring Integration

Copyright © 2010. All Rights Reserved.