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
private  ChannelRegistry channelRegistry
           
protected  org.apache.commons.logging.Log logger
           
private  boolean resolutionRequired
           
private  long timeout
           
 
Constructor Summary
AbstractRoutingMessageHandler()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  ChannelRegistry getChannelRegistry()
           
 Message<?> handle(Message<?> message)
           
protected abstract  java.util.List<MessageChannel> resolveChannels(Message<?> message)
           
private  void sendMesage(Message<?> message, MessageChannel channel)
           
 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

channelRegistry

private ChannelRegistry channelRegistry

resolutionRequired

private boolean resolutionRequired

timeout

private long timeout
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

sendMesage

private void sendMesage(Message<?> message,
                        MessageChannel channel)

validate

protected abstract void validate()
                          throws ConfigurationException
Throws:
ConfigurationException

resolveChannels

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