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:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, Orderable, MessageHandler, MessageProducer, TrackableComponent
Direct Known Subclasses:
AbstractMessageSplitter, AbstractRemoteFileOutboundGateway, AbstractWebServiceOutboundGateway, AmqpOutboundEndpoint, BridgeHandler, ContentEnricher, FileWritingMessageHandler, HttpRequestExecutingMessageHandler, JdbcOutboundGateway, JmsOutboundGateway, MessageFilter, MessageTransformingHandler, OperationInvokingMessageHandler, RmiOutboundGateway, ServiceActivatingHandler, StoredProcOutboundGateway, TcpOutboundGateway

public abstract class AbstractReplyProducingMessageHandler
extends AbstractMessageHandler
implements MessageProducer

Base class for MessageHandlers that are capable of producing replies.


Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AbstractReplyProducingMessageHandler()
           
 
Method Summary
protected  MessagingTemplate getMessagingTemplate()
          Provides access to the MessagingTemplate for subclasses.
protected  void handleMessageInternal(Message<?> message)
          
protected abstract  java.lang.Object handleRequestMessage(Message<?> requestMessage)
          Subclasses must implement this method to handle the request Message.
protected  void onInit()
          Subclasses may implement this for initialization logic.
 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 whether a reply is required.
 void setSendTimeout(long sendTimeout)
          Set the timeout for sending reply Messages.
protected  boolean shouldCopyRequestHeaders()
          Subclasses may override this.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

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

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.


setRequiresReply

public void setRequiresReply(boolean requiresReply)
Flag whether a 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. Default is false.


getMessagingTemplate

protected MessagingTemplate getMessagingTemplate()
Provides access to the MessagingTemplate for subclasses.


onInit

protected void onInit()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class IntegrationObjectSupport

handleMessageInternal

protected final void handleMessageInternal(Message<?> message)

Specified by:
handleMessageInternal in class AbstractMessageHandler

shouldCopyRequestHeaders

protected boolean shouldCopyRequestHeaders()
Subclasses may override this. True by default.


handleRequestMessage

protected abstract java.lang.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.