org.springframework.integration.router
Class AbstractRoutingMessageHandler

java.lang.Object
  extended by org.springframework.integration.router.AbstractRoutingMessageHandler
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, ChannelRegistryAware, MessageHandler
Direct Known Subclasses:
MultiChannelRouter, SingleChannelRouter

public abstract class AbstractRoutingMessageHandler
extends java.lang.Object
implements MessageHandler, ChannelRegistryAware, org.springframework.beans.factory.InitializingBean

Base class for message router implementations.

Author:
Mark Fisher

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractRoutingMessageHandler()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  ChannelRegistry getChannelRegistry()
           
 Message<?> handle(Message<?> message)
           
protected abstract  java.util.List<MessageChannel> resolveChannels(Message<?> message)
           
 void setChannelRegistry(ChannelRegistry channelRegistry)
           
 void setResolutionRequired(boolean resolutionRequired)
          Set whether this router should always be required to resolve at least one channel.
 void setTimeout(long timeout)
          Set the timeout for sending a message to the resolved channel.
protected abstract  void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.commons.logging.Log logger
Constructor Detail

AbstractRoutingMessageHandler

public AbstractRoutingMessageHandler()
Method Detail

setResolutionRequired

public void setResolutionRequired(boolean resolutionRequired)
Set whether this router should always be required to resolve at least one channel. The default is 'false'. To trigger an exception whenever the resolver returns null or an empty channel list, set this value to 'true'.


setTimeout

public void setTimeout(long timeout)
Set the timeout for sending a message to the resolved channel. By default, there is no timeout, meaning the send will block indefinitely.


setChannelRegistry

public void setChannelRegistry(ChannelRegistry channelRegistry)
Specified by:
setChannelRegistry in interface ChannelRegistryAware

getChannelRegistry

protected ChannelRegistry getChannelRegistry()

afterPropertiesSet

public final void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

handle

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

validate

protected abstract void validate()
                          throws MessagingConfigurationException
Throws:
MessagingConfigurationException

resolveChannels

protected abstract java.util.List<MessageChannel> resolveChannels(Message<?> message)