public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter implements MappingMessageRouterManagement
IntegrationManagement.ManagementOverrides
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
channelMappings |
EXPRESSION_PARSER, logger
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractMappingMessageRouter() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<org.springframework.messaging.MessageChannel> |
determineTargetChannels(org.springframework.messaging.Message<?> message)
Subclasses must implement this method to return a Collection of zero or more
MessageChannels to which the given Message should be routed.
|
protected abstract java.util.List<java.lang.Object> |
getChannelKeys(org.springframework.messaging.Message<?> message)
Subclasses must implement this method to return the channel keys.
|
java.util.Map<java.lang.String,java.lang.String> |
getChannelMappings()
Returns an unmodifiable version of the channel mappings.
|
java.util.Collection<java.lang.String> |
getDynamicChannelNames()
Provide a collection of channel names to which
we have routed messages where the channel was not explicitly mapped.
|
void |
removeChannelMapping(java.lang.String key)
Remove a channel mapping for the given key if present.
|
void |
replaceChannelMappings(java.util.Properties channelMappings)
Convenience method allowing conversion of a list
of mappings in a control-bus message.
|
void |
setChannelMapping(java.lang.String key,
java.lang.String channelName)
Add a channel mapping from the provided key to channel name.
|
void |
setChannelMappings(java.util.Map<java.lang.String,java.lang.String> channelMappings)
Provide mappings from channel keys to channel names.
|
void |
setDynamicChannelLimit(int dynamicChannelLimit)
Set a limit for how many dynamic channels are retained (for reporting purposes).
|
void |
setPrefix(java.lang.String prefix)
Specify a prefix to be added to each channel name prior to resolution.
|
void |
setResolutionRequired(boolean resolutionRequired)
Specify whether this router should ignore any failure to resolve a channel name to
an actual MessageChannel instance when delegating to the ChannelResolver strategy.
|
void |
setSuffix(java.lang.String suffix)
Specify a suffix to be added to each channel name prior to resolution.
|
getComponentType, getDefaultOutputChannel, getMessagingTemplate, getRequiredConversionService, handleMessageInternal, onInit, setApplySequence, setDefaultOutputChannel, setDefaultOutputChannelName, setIgnoreSendFailures, setSendTimeout
configureMetrics, getActiveCount, getActiveCountLong, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, onComplete, onError, onNext, onSubscribe, registerMetricsCaptor, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
protected volatile java.util.Map<java.lang.String,java.lang.String> channelMappings
@ManagedAttribute public void setChannelMappings(java.util.Map<java.lang.String,java.lang.String> channelMappings)
DestinationResolver
.setChannelMappings
in interface MappingMessageRouterManagement
channelMappings
- The channel mappings.public void setPrefix(java.lang.String prefix)
prefix
- The prefix.public void setSuffix(java.lang.String suffix)
suffix
- The suffix.public void setResolutionRequired(boolean resolutionRequired)
resolutionRequired
- true if resolution is required.public void setDynamicChannelLimit(int dynamicChannelLimit)
NOTE: this does not affect routing, just the reporting which dynamically
resolved channels have been routed to. Default 100
.
dynamicChannelLimit
- the limit.getDynamicChannelNames()
@ManagedAttribute public java.util.Map<java.lang.String,java.lang.String> getChannelMappings()
getChannelMappings
in interface MappingMessageRouterManagement
@ManagedOperation public void setChannelMapping(java.lang.String key, java.lang.String channelName)
setChannelMapping
in interface MappingMessageRouterManagement
key
- The key.channelName
- The channel name.@ManagedOperation public void removeChannelMapping(java.lang.String key)
removeChannelMapping
in interface MappingMessageRouterManagement
key
- The key.@ManagedAttribute public java.util.Collection<java.lang.String> getDynamicChannelNames()
MappingMessageRouterManagement
Implementations may choose to return only the most recent channel names.
getDynamicChannelNames
in interface MappingMessageRouterManagement
protected abstract java.util.List<java.lang.Object> getChannelKeys(org.springframework.messaging.Message<?> message)
message
- The message.protected java.util.Collection<org.springframework.messaging.MessageChannel> determineTargetChannels(org.springframework.messaging.Message<?> message)
AbstractMessageRouter
determineTargetChannels
in class AbstractMessageRouter
message
- The message.@ManagedOperation public void replaceChannelMappings(java.util.Properties channelMappings)
This is intended to be called via a control-bus; keys and values that are not Strings will be ignored.
Mappings must be delimited with newlines, for example:
"@'myRouter.handler'.replaceChannelMappings('foo=qux \n baz=bar')"
.
replaceChannelMappings
in interface MappingMessageRouterManagement
channelMappings
- The channel mappings.