Class RouterSpec<K,R extends AbstractMappingMessageRouter>
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,reactor.util.function.Tuple2<F,H>>
org.springframework.integration.dsl.EndpointSpec<S,ConsumerEndpointFactoryBean,H>
org.springframework.integration.dsl.ConsumerEndpointSpec<S,R>
org.springframework.integration.dsl.AbstractRouterSpec<RouterSpec<K,R>,R>
org.springframework.integration.dsl.RouterSpec<K,R>
- Type Parameters:
K- the key type.R- theAbstractMappingMessageRouterimplementation type.
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,DisposableBean,FactoryBean<reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,,R>> InitializingBean,Lifecycle,Phased,SmartLifecycle,ComponentsRegistration
public final class RouterSpec<K,R extends AbstractMappingMessageRouter>
extends AbstractRouterSpec<RouterSpec<K,R>,R>
The
AbstractRouterSpec for an AbstractMappingMessageRouter.- Since:
- 5.0
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.ConsumerEndpointSpec
adviceChainFields inherited from class org.springframework.integration.dsl.EndpointSpec
componentsToRegister, endpointFactoryBean, handlerFields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, targetFields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
loggerFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRouterSpec<K,R> channelKeyFallback(boolean channelKeyFallback) When true (default), if a resolved channel key does not exist in the channel map, the key itself is used as the channel name, which we will attempt to resolve to a channel.RouterSpec<K,R> channelMapping(K key, String channelName) RouterSpec<K,R> channelMapping(K key, MessageChannel channel) The router mapping configuration based on the provided generic key andMessageChannelbean.RouterSpec<K,R> Make a default output mapping of the router to the parent flow.RouterSpec<K,R> dynamicChannelLimit(int dynamicChannelLimit) Set a limit for how many dynamic channels are retained (for reporting purposes).RouterSpec<K,R> Deprecated, for removal: This API element is subject to removal in a future version.RouterSpec<K,R> Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)is used.RouterSpec<K,R> resolutionRequired(boolean resolutionRequired) RouterSpec<K,R> subFlowMapping(K key, IntegrationFlow subFlow) Add a subflow as an alternative to achannelMapping(Object, String).RouterSpec<K,R> Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)is used.Methods inherited from class org.springframework.integration.dsl.AbstractRouterSpec
applySequence, defaultOutputChannel, defaultOutputChannel, defaultSubFlowMapping, ignoreSendFailures, isDefaultToParentFlowMethods inherited from class org.springframework.integration.dsl.ConsumerEndpointSpec
advice, async, autoStartup, customizeMonoReply, doGet, handleMessageAdvice, notPropagatedHeaders, order, phase, poller, reactive, reactive, requiresReply, role, sendTimeout, taskScheduler, transactional, transactional, transactional, transactional, transactionalMethods inherited from class org.springframework.integration.dsl.EndpointSpec
assertHandler, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, pollerMethods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stopMethods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
RouterSpec
-
-
Method Details
-
resolutionRequired
- Parameters:
resolutionRequired- the resolutionRequired.- Returns:
- the router spec.
- See Also:
-
dynamicChannelLimit
Set a limit for how many dynamic channels are retained (for reporting purposes). When the limit is exceeded, the oldest channel is discarded.NOTE: this does not affect routing, just the reporting which dynamically resolved channels have been routed to. Default
100.- Parameters:
dynamicChannelLimit- the limit.- Returns:
- the router spec.
- See Also:
-
prefix
Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)is used.- Parameters:
prefix- the prefix.- Returns:
- the router spec.
- See Also:
-
suffix
Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)is used.- Parameters:
suffix- the suffix to set.- Returns:
- the router spec.
- See Also:
-
noChannelKeyFallback
Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 in favor ofchannelKeyFallback(boolean)By default, if a resolved channel key does not exist in the channel map, the key itself is used as the channel name, which we will attempt to resolve to a channel. Invoke this method to disable this feature. This could be useful to prevent malicious actors from generating a message that could cause the message to be routed to an unexpected channel, such as one upstream of the router, which would cause a stack overflow.- Returns:
- the router spec.
- Since:
- 5.2
-
channelKeyFallback
When true (default), if a resolved channel key does not exist in the channel map, the key itself is used as the channel name, which we will attempt to resolve to a channel. Set tofalseto disable this feature.- Parameters:
channelKeyFallback- false to disable the fallback.- Returns:
- the router spec.
- Since:
- 6.0
- See Also:
-
channelMapping
- Parameters:
key- the key.channelName- the channelName.- Returns:
- the router spec.
- See Also:
-
channelMapping
The router mapping configuration based on the provided generic key andMessageChannelbean. TheMessageChannelmust be instance ofNamedComponentfor proper target router mapping based on the bean name.- Parameters:
key- the key.channel- theMessageChannelinstance to use.- Returns:
- the router spec.
- Since:
- 5.2
- See Also:
-
subFlowMapping
Add a subflow as an alternative to achannelMapping(Object, String).prefix(String)andsuffix(String)cannot be used when subflow mappings are used.If subflow should refer to the external
IntegrationFlowbean and there is a requirement to expect reply from there, such a reference should be wrapped with a.gateway():.subFlowMapping(false, sf -> sf.gateway(evenFlow())))- Parameters:
key- the key.subFlow- the subFlow.- Returns:
- the router spec.
-
defaultOutputToParentFlow
Make a default output mapping of the router to the parent flow. Use the next, after router, parent flowMessageChannelas aAbstractMessageRouter.setDefaultOutputChannel(MessageChannel)of this router. This option also disablesAbstractMappingMessageRouter.setChannelKeyFallback(boolean), if not called explicitly afterwards, to skip an attempt to resolve the channel name.- Overrides:
defaultOutputToParentFlowin classAbstractRouterSpec<RouterSpec<K,R extends AbstractMappingMessageRouter>, R extends AbstractMappingMessageRouter> - Returns:
- the router spec.
- Since:
- 6.0
-
getComponentsToRegister
- Specified by:
getComponentsToRegisterin interfaceComponentsRegistration- Overrides:
getComponentsToRegisterin classEndpointSpec<RouterSpec<K,R extends AbstractMappingMessageRouter>, ConsumerEndpointFactoryBean, R extends AbstractMappingMessageRouter>
-
channelKeyFallback(boolean)