Class RecipientListRouter
- All Implemented Interfaces:
- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Ordered,- ComponentSourceAware,- ExpressionCapable,- Orderable,- IntegrationPattern,- MessageRouter,- RecipientListRouterManagement,- NamedComponent,- IntegrationManagement,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
 
 <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 AbstractMappingMessageRouter 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.
- Author:
- Mark Fisher, Oleg Zhurakousky, Artem Bilan, Liujiong, Gary Russell
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddRecipient(String channelName) Add a recipient with channelName.voidaddRecipient(String channelName, String selectorExpression) Add a recipient with channelName and expression.voidaddRecipient(String channelName, MessageSelector selector) voidaddRecipient(MessageChannel channel) voidaddRecipient(MessageChannel channel, MessageSelector selector) protected 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.Subclasses may implement this method to provide component type information.Return a pattern type this component implements.protected voidonInit()Subclasses may implement this for initialization logic.intremoveRecipient(String channelName) Remove all recipients that match the channelName.intremoveRecipient(String channelName, String selectorExpression) Remove all recipients that match the channelName and expression.voidreplaceRecipients(Properties recipientMappings) Replace recipient.voidsetChannels(List<MessageChannel> channels) Set the channels for this router.voidsetRecipientMappings(Map<String, String> recipientMappings) Set the recipients for this router.voidsetRecipients(List<RecipientListRouter.Recipient> recipients) Set the recipients for this router.Methods inherited from class org.springframework.integration.router.AbstractMessageRoutergetDefaultOutputChannel, getMessagingTemplate, getRequiredConversionService, handleMessageInternal, setApplySequence, setDefaultOutputChannel, setDefaultOutputChannelName, setIgnoreSendFailures, setSendTimeoutMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
RecipientListRouterpublic RecipientListRouter()
 
- 
- 
Method Details- 
setChannelsSet the channels for this router. Either call this method orsetRecipients(List)but not both. If MessageSelectors should be considered, then usesetRecipients(List).- Parameters:
- channels- The channels.
 
- 
setRecipientsSet the recipients for this router.- Parameters:
- recipients- The recipients.
 
- 
setRecipientMappingsSet the recipients for this router.- Specified by:
- setRecipientMappingsin interface- RecipientListRouterManagement
- Parameters:
- recipientMappings- map contains channelName and expression
 
- 
addRecipientDescription copied from interface:RecipientListRouterManagementAdd a recipient with channelName and expression. The expression follows onlySimpleEvaluationContext.forReadOnlyDataBinding()capabilities. Otherwise, use non-managedaddRecipient(String, MessageSelector)API with more control over execution.- Specified by:
- addRecipientin interface- RecipientListRouterManagement
- Parameters:
- channelName- The channel name.
- selectorExpression- The expression to filter the incoming message.
 
- 
addRecipientDescription copied from interface:RecipientListRouterManagementAdd a recipient with channelName.- Specified by:
- addRecipientin interface- RecipientListRouterManagement
- Parameters:
- channelName- The channel name.
 
- 
addRecipient
- 
addRecipient
- 
addRecipient
- 
removeRecipientDescription copied from interface:RecipientListRouterManagementRemove all recipients that match the channelName.- Specified by:
- removeRecipientin interface- RecipientListRouterManagement
- Parameters:
- channelName- The channel name.
- Returns:
- The number of recipients removed.
 
- 
removeRecipientDescription copied from interface:RecipientListRouterManagementRemove all recipients that match the channelName and expression.- Specified by:
- removeRecipientin interface- RecipientListRouterManagement
- Parameters:
- channelName- The channel name.
- selectorExpression- The expression to filter the incoming message
- Returns:
- The number of recipients removed.
 
- 
replaceRecipientsDescription copied from interface:RecipientListRouterManagementReplace recipient. The expression follows onlySimpleEvaluationContext.forReadOnlyDataBinding()capabilities. Otherwise, use non-managedaddRecipient(String, MessageSelector)API with more control over execution.- Specified by:
- replaceRecipientsin interface- RecipientListRouterManagement
- Parameters:
- recipientMappings- contain channelName and expression.
 
- 
getRecipients- Specified by:
- getRecipientsin interface- RecipientListRouterManagement
- Returns:
- an unmodifiable collection of recipients.
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- AbstractMessageRouter
 
- 
getIntegrationPatternTypeDescription copied from interface:IntegrationPatternReturn a pattern type this component implements.- Specified by:
- getIntegrationPatternTypein interface- IntegrationPattern
- Overrides:
- getIntegrationPatternTypein class- AbstractMessageRouter
- Returns:
- the IntegrationPatternTypethis component implements.
 
- 
determineTargetChannelsDescription copied from class:AbstractMessageRouterSubclasses must implement this method to return a Collection of zero or more MessageChannels to which the given Message should be routed.- Specified by:
- determineTargetChannelsin class- AbstractMessageRouter
- Parameters:
- message- The message.
- Returns:
- The collection of message channels.
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractMessageRouter
 
 
-