org.springframework.integration.router
Class RecipientListRouter

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandler
      extended by org.springframework.integration.router.RecipientListRouter
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, MessageHandler

public class RecipientListRouter
extends AbstractMessageHandler
implements org.springframework.beans.factory.InitializingBean

A Message Router that sends Messages to a list of recipient channels. The recipients can be provided as a static list of MessageChannel instances via the setChannels(List) method, or for dynamic behavior, a map with MessageSelector instances as the keys and collections of channels as the values can be provided via the setChannelMap(Map) method. For more advanced, programmatic control of dynamic recipient lists, consider using the @Router annotation or extending AbstractChannelNameResolvingMessageRouter instead.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
RecipientListRouter()
           
 
Method Summary
 void afterPropertiesSet()
           
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 setChannelMap(java.util.Map<MessageSelector,? extends java.util.Collection<MessageChannel>> channelMap)
           
 void setChannels(java.util.List<MessageChannel> 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(s).
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getOrder, handleMessage, resolveReplyChannel, setOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecipientListRouter

public RecipientListRouter()
Method Detail

setChannels

public void setChannels(java.util.List<MessageChannel> channels)

setChannelMap

public void setChannelMap(java.util.Map<MessageSelector,? extends java.util.Collection<MessageChannel>> channelMap)

setTimeout

public void setTimeout(long timeout)
Set the timeout for sending a message to the resolved channel(s). 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.


afterPropertiesSet

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

handleMessageInternal

protected void handleMessageInternal(Message<?> message)
                              throws java.lang.Exception
Specified by:
handleMessageInternal in class AbstractMessageHandler
Throws:
java.lang.Exception