@ManagedResource @IntegrationManagedResource public abstract class AbstractMessageRouter extends AbstractMessageHandler implements MessageRouter
IntegrationManagement.ManagementOverrides
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractMessageRouter() |
Modifier and Type | Method and Description |
---|---|
protected abstract 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.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
MessageChannel |
getDefaultOutputChannel()
Get the default output channel.
|
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
protected MessagingTemplate |
getMessagingTemplate()
Provides
MessagingTemplate access for subclasses |
protected ConversionService |
getRequiredConversionService() |
protected void |
handleMessageInternal(Message<?> message) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setApplySequence(boolean applySequence)
Specify whether to apply the sequence number and size headers to the messages prior to sending to the recipient
channels.
|
void |
setDefaultOutputChannel(MessageChannel defaultOutputChannel)
Set the default channel where Messages should be sent if channel resolution
fails to return any channels.
|
void |
setDefaultOutputChannelName(String defaultOutputChannelName) |
void |
setIgnoreSendFailures(boolean ignoreSendFailures)
Specify whether send failures for one or more of the recipients should be ignored.
|
void |
setSendTimeout(long timeout)
Set the timeout for sending a message to the resolved channel.
|
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, 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
getThisAs
getBeanName, getComponentName
public void setDefaultOutputChannel(MessageChannel defaultOutputChannel)
MessageDeliveryException
.
If messages shall be ignored (dropped) instead, please provide a
NullChannel
.
defaultOutputChannel
- The default output channel.public MessageChannel getDefaultOutputChannel()
getDefaultOutputChannel
in interface MessageRouter
public void setDefaultOutputChannelName(String defaultOutputChannelName)
public void setSendTimeout(long timeout)
timeout
- The timeout.public void setIgnoreSendFailures(boolean ignoreSendFailures)
false
meaning that an Exception will be thrown whenever a send fails. To override this and suppress
Exceptions, set the value to true
.ignoreSendFailures
- true to ignore send failures.public void setApplySequence(boolean applySequence)
false
meaning that sequence headers will not be
applied. If planning to use an Aggregator downstream with the default correlation and completion strategies, you
should set this flag to true
.applySequence
- true to apply sequence information.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
public IntegrationPatternType getIntegrationPatternType()
IntegrationPattern
getIntegrationPatternType
in interface IntegrationPattern
getIntegrationPatternType
in class MessageHandlerSupport
IntegrationPatternType
this component implements.protected MessagingTemplate getMessagingTemplate()
MessagingTemplate
access for subclassesprotected ConversionService getRequiredConversionService()
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
protected abstract Collection<MessageChannel> determineTargetChannels(Message<?> message)
message
- The message.protected void handleMessageInternal(Message<?> message)
handleMessageInternal
in class AbstractMessageHandler