org.springframework.integration.router
Class AbstractMessageRouter

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.router.AbstractMessageRouter
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, TrackableComponent
Direct Known Subclasses:
AbstractMappingMessageRouter, RecipientListRouter

@ManagedResource
public abstract class AbstractMessageRouter
extends AbstractMessageHandler

Base class for all Message Routers.


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
AbstractMessageRouter()
           
 
Method Summary
protected abstract  java.util.Collection<MessageChannel> determineTargetChannels(Message<?> message)
          Subclasses must implement this method to return a Collection of zero or more MessageChannels to which the given Message should be routed.
 java.lang.String getComponentType()
          Subclasses may implement this method to provide component type information.
protected  MessagingTemplate getMessagingTemplate()
          Provides MessagingTemplate access for subclasses.
protected  org.springframework.core.convert.ConversionService getRequiredConversionService()
           
protected  void handleMessageInternal(Message<?> message)
           
 void setApplySequence(boolean applySequence)
          Specify whether to apply the sequence number and size headers to the messages prior to sending to the recipient channels.
 void setDefaultOutputChannel(MessageChannel defaultOutputChannel)
          Set the default channel where Messages should be sent if channel resolution fails to return any channels.
 void setIgnoreSendFailures(boolean ignoreSendFailures)
          Specify whether send failures for one or more of the recipients should be ignored.
 void setTimeout(long timeout)
          Set the timeout for sending a message to the resolved channel.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, 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

AbstractMessageRouter

public AbstractMessageRouter()
Method Detail

setDefaultOutputChannel

public void setDefaultOutputChannel(MessageChannel defaultOutputChannel)
Set the default channel where Messages should be sent if channel resolution fails to return any channels. If no default channel is provided and channel resolution fails to return any channels, the router will throw an MessageDeliveryException. If messages shall be ignored (dropped) instead, please provide a NullChannel.


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.


setIgnoreSendFailures

public void setIgnoreSendFailures(boolean ignoreSendFailures)
Specify whether send failures for one or more of the recipients should be ignored. By default this is false meaning that an Exception will be thrown whenever a send fails. To override this and suppress Exceptions, set the value to true.


setApplySequence

public void setApplySequence(boolean applySequence)
Specify whether to apply the sequence number and size headers to the messages prior to sending to the recipient channels. By default, this value is false meaning that sequence headers will not be applied. If planning to use an Aggregator downstream with the default correlation and completion strategies, you should set this flag to true.


getComponentType

public java.lang.String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class AbstractMessageHandler

getMessagingTemplate

protected MessagingTemplate getMessagingTemplate()
Provides MessagingTemplate access for subclasses.


getRequiredConversionService

protected org.springframework.core.convert.ConversionService getRequiredConversionService()

determineTargetChannels

protected abstract java.util.Collection<MessageChannel> determineTargetChannels(Message<?> message)
Subclasses must implement this method to return a Collection of zero or more MessageChannels to which the given Message should be routed.


handleMessageInternal

protected void handleMessageInternal(Message<?> message)
Specified by:
handleMessageInternal in class AbstractMessageHandler