org.springframework.integration.router
Class RecipientListRouter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.router.AbstractMessageRouter
org.springframework.integration.router.RecipientListRouter
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, NamedComponent, Orderable, MessageHandler, TrackableComponent
public class RecipientListRouter
- extends AbstractMessageRouter
- implements InitializingBean
<recipient-list-router id="simpleRouter" input-channel="routingChannelA">
<recipient channel="channel1"/>
<recipient channel="channel2"/>
</recipient-list-router>
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,
the values can be provided via the setRecipients(List)
method.
For more advanced, programmatic control of dynamic recipient lists, consider
using the @Router annotation or extending AbstractMessageRouter
instead.
Contrary to a standard <router .../> this handler will try to send to
all channels that are configured as recipients. It is to channels what a
publish subscribe channel is to endpoints.
Using this class only makes sense if it is essential to send messages on
multiple channels instead of sending them to multiple handlers. If the latter
is an option using a publish subscribe channel is the more flexible solution.
Methods inherited from class org.springframework.integration.router.AbstractMessageRouter |
getMessagingTemplate, getRequiredConversionService, handleMessageInternal, removeChannelMapping, setApplySequence, setChannelIdentifierMap, setChannelMapping, setChannelResolver, setDefaultOutputChannel, setIgnoreChannelNameResolutionFailures, setIgnoreSendFailures, setPrefix, setResolutionRequired, setSuffix, setTimeout |
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 |
RecipientListRouter
public RecipientListRouter()
setChannels
public void setChannels(java.util.List<MessageChannel> channels)
- Set the channels for this router. Either call this method or
setRecipients(List)
but not both. If MessageSelectors should be
considered, then use setRecipients(List)
.
setRecipients
public void setRecipients(java.util.List<RecipientListRouter.Recipient> recipients)
- Set the recipients for this router.
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 AbstractMessageRouter
onInit
public final void onInit()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class AbstractMessageRouter
getChannelIdentifiers
protected java.util.List<java.lang.Object> getChannelIdentifiers(Message<?> message)
- Description copied from class:
AbstractMessageRouter
- Subclasses must implement this method to return the channel identifiers.
- Specified by:
getChannelIdentifiers
in class AbstractMessageRouter