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
- theAbstractMappingMessageRouter
implementation 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.EndpointSpec
componentsToRegister, endpointFactoryBean, handler
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target
-
Constructor Summary
Constructors Modifier Constructor Description protected
RouterSpec(R router)
-
Method Summary
Modifier and Type Method Description 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 andMessageChannel
bean.RouterSpec<K,R>
dynamicChannelLimit(int dynamicChannelLimit)
Set a limit for how many dynamic channels are retained (for reporting purposes).Map<Object,String>
getComponentsToRegister()
RouterSpec<K,R>
noChannelKeyFallback()
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.RouterSpec<K,R>
prefix(String prefix)
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>
suffix(String suffix)
Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)
is used.Methods inherited from class org.springframework.integration.dsl.AbstractRouterSpec
applySequence, defaultOutputChannel, defaultOutputChannel, defaultOutputToParentFlow, defaultSubFlowMapping, ignoreSendFailures, isDefaultToParentFlow
Methods 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, transactional
Methods inherited from class org.springframework.integration.dsl.EndpointSpec
assertHandler, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, poller
Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
Method Details
-
resolutionRequired
- Parameters:
resolutionRequired
- the resolutionRequired.- Returns:
- the router spec.
- See Also:
AbstractMappingMessageRouter.setResolutionRequired(boolean)
-
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:
AbstractMappingMessageRouter.setDynamicChannelLimit(int)
-
prefix
Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)
is used.- Parameters:
prefix
- the prefix.- Returns:
- the router spec.
- See Also:
AbstractMappingMessageRouter.setPrefix(String)
-
suffix
Cannot be invoked ifsubFlowMapping(Object, IntegrationFlow)
is used.- Parameters:
suffix
- the suffix to set.- Returns:
- the router spec.
- See Also:
AbstractMappingMessageRouter.setSuffix(String)
-
noChannelKeyFallback
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
-
channelMapping
- Parameters:
key
- the key.channelName
- the channelName.- Returns:
- the router spec.
- See Also:
AbstractMappingMessageRouter.setChannelMapping(String, String)
-
channelMapping
The router mapping configuration based on the provided generic key andMessageChannel
bean. TheMessageChannel
must be instance ofNamedComponent
for proper target router mapping based on the bean name.- Parameters:
key
- the key.channel
- theMessageChannel
instance to use.- Returns:
- the router spec.
- Since:
- 5.2
- See Also:
AbstractMappingMessageRouter.setChannelMapping(String, String)
-
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
IntegrationFlow
bean 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.
-
getComponentsToRegister
- Specified by:
getComponentsToRegister
in interfaceComponentsRegistration
- Overrides:
getComponentsToRegister
in classEndpointSpec<RouterSpec<K,R extends AbstractMappingMessageRouter>,ConsumerEndpointFactoryBean,R extends AbstractMappingMessageRouter>
-