@IntegrationManagedResource public abstract class AbstractMessageChannel extends IntegrationObjectSupport implements org.springframework.messaging.MessageChannel, TrackableComponent, ChannelInterceptorAware, MessageChannelMetrics, ConfigurableMetricsAware<AbstractMessageChannelMetrics>
MessageChannel implementations providing common
properties such as the channel name. Also provides the common functionality
for sending and receiving Messages including the invocation
of any ChannelInterceptors.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractMessageChannel.ChannelInterceptorList
A convenience wrapper class for the list of ChannelInterceptors.
|
IntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
protected AbstractMessageChannel.ChannelInterceptorList |
interceptors |
EXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME| Constructor and Description |
|---|
AbstractMessageChannel() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
Add a channel interceptor to the end of the list.
|
void |
addInterceptor(int index,
org.springframework.messaging.support.ChannelInterceptor interceptor)
Add a channel interceptor to the specified index of the list.
|
void |
configureMetrics(AbstractMessageChannelMetrics metrics) |
protected abstract boolean |
doSend(org.springframework.messaging.Message<?> message,
long timeout)
Subclasses must implement this method.
|
java.util.List<org.springframework.messaging.support.ChannelInterceptor> |
getChannelInterceptors()
Return a read-only list of the configured interceptors.
|
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
Statistics |
getErrorRate() |
java.lang.String |
getFullChannelName()
Returns the fully qualified channel name including the application context
id, if available.
|
protected AbstractMessageChannel.ChannelInterceptorList |
getInterceptors()
Exposes the interceptor list for subclasses.
|
double |
getMaxSendDuration() |
double |
getMeanErrorRate() |
double |
getMeanErrorRatio() |
double |
getMeanSendDuration() |
double |
getMeanSendRate() |
protected AbstractMessageChannelMetrics |
getMetrics() |
protected MetricsCaptor |
getMetricsCaptor() |
double |
getMinSendDuration() |
IntegrationManagement.ManagementOverrides |
getOverrides()
Return the overrides.
|
int |
getSendCount() |
long |
getSendCountLong() |
Statistics |
getSendDuration() |
int |
getSendErrorCount() |
long |
getSendErrorCountLong() |
Statistics |
getSendRate() |
double |
getStandardDeviationSendDuration() |
double |
getTimeSinceLastSend() |
boolean |
isCountsEnabled() |
boolean |
isLoggingEnabled() |
boolean |
isStatsEnabled() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
registerMetricsCaptor(MetricsCaptor metricsCaptor)
Inject a
MetricsCaptor |
boolean |
removeInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
Remove the provided
ChannelInterceptor from the target implementation. |
org.springframework.messaging.support.ChannelInterceptor |
removeInterceptor(int index)
Remove a
ChannelInterceptor from the target implementation for specific index. |
void |
reset() |
boolean |
send(org.springframework.messaging.Message<?> message)
Send a message on this channel.
|
boolean |
send(org.springframework.messaging.Message<?> message,
long timeout)
Send a message on this channel.
|
void |
setCountsEnabled(boolean countsEnabled) |
void |
setDatatypes(java.lang.Class<?>... datatypes)
Specify the Message payload datatype(s) supported by this channel.
|
void |
setInterceptors(java.util.List<org.springframework.messaging.support.ChannelInterceptor> interceptors)
Set the list of channel interceptors.
|
void |
setLoggingEnabled(boolean loggingEnabled) |
void |
setMessageConverter(org.springframework.messaging.converter.MessageConverter messageConverter)
Specify the
MessageConverter to use when trying to convert to
one of this channel's supported datatypes (in order) for a Message whose payload
does not already match. |
void |
setShouldTrack(boolean shouldTrack) |
void |
setStatsEnabled(boolean statsEnabled) |
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNameprotected final AbstractMessageChannel.ChannelInterceptorList interceptors
public java.lang.String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic void setShouldTrack(boolean shouldTrack)
setShouldTrack in interface TrackableComponentpublic void registerMetricsCaptor(MetricsCaptor metricsCaptor)
IntegrationManagementMetricsCaptorregisterMetricsCaptor in interface IntegrationManagementmetricsCaptor - the captor.protected MetricsCaptor getMetricsCaptor()
public void setCountsEnabled(boolean countsEnabled)
setCountsEnabled in interface IntegrationManagementpublic boolean isCountsEnabled()
isCountsEnabled in interface IntegrationManagementpublic void setStatsEnabled(boolean statsEnabled)
setStatsEnabled in interface IntegrationStatsManagementpublic boolean isStatsEnabled()
isStatsEnabled in interface IntegrationStatsManagementpublic boolean isLoggingEnabled()
isLoggingEnabled in interface IntegrationManagementpublic void setLoggingEnabled(boolean loggingEnabled)
setLoggingEnabled in interface IntegrationManagementprotected AbstractMessageChannelMetrics getMetrics()
public void configureMetrics(AbstractMessageChannelMetrics metrics)
configureMetrics in interface ConfigurableMetricsAware<AbstractMessageChannelMetrics>public void setDatatypes(java.lang.Class<?>... datatypes)
If this property is not set explicitly, any Message payload type will be accepted.
datatypes - The supported data types.setMessageConverter(MessageConverter)public void setInterceptors(java.util.List<org.springframework.messaging.support.ChannelInterceptor> interceptors)
setInterceptors in interface ChannelInterceptorAwareinterceptors - The list of interceptors.public void addInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
addInterceptor in interface ChannelInterceptorAwareinterceptor - The interceptor.public void addInterceptor(int index,
org.springframework.messaging.support.ChannelInterceptor interceptor)
addInterceptor in interface ChannelInterceptorAwareindex - The index to add interceptor.interceptor - The interceptor.public void setMessageConverter(org.springframework.messaging.converter.MessageConverter messageConverter)
MessageConverter to use when trying to convert to
one of this channel's supported datatypes (in order) for a Message whose payload
does not already match.
Note: only the MessageConverter.fromMessage(Message, Class)
method is used. If the returned object is not a Message, the inbound
headers will be copied; if the returned object is a Message, it is
expected that the converter will have fully populated the headers; no
further action is performed by the channel. If null is returned,
conversion to the next datatype (if any) will be attempted.
Defaults to a DefaultDatatypeChannelMessageConverter.
messageConverter - The message converter.public java.util.List<org.springframework.messaging.support.ChannelInterceptor> getChannelInterceptors()
getChannelInterceptors in interface ChannelInterceptorAwareChannelInterceptor list.public boolean removeInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
ChannelInterceptorAwareChannelInterceptor from the target implementation.removeInterceptor in interface ChannelInterceptorAwareinterceptor - ChannelInterceptor to remove.boolean if ChannelInterceptor has been removed.public org.springframework.messaging.support.ChannelInterceptor removeInterceptor(int index)
ChannelInterceptorAwareChannelInterceptor from the target implementation for specific index.removeInterceptor in interface ChannelInterceptorAwareindex - the index for the ChannelInterceptor to remove.boolean if the ChannelInterceptor has been removed.protected AbstractMessageChannel.ChannelInterceptorList getInterceptors()
public void reset()
reset in interface IntegrationManagementpublic int getSendCount()
getSendCount in interface MessageChannelMetricspublic long getSendCountLong()
getSendCountLong in interface MessageChannelMetricspublic int getSendErrorCount()
getSendErrorCount in interface MessageChannelMetricspublic long getSendErrorCountLong()
getSendErrorCountLong in interface MessageChannelMetricspublic double getTimeSinceLastSend()
getTimeSinceLastSend in interface MessageChannelMetricspublic double getMeanSendRate()
getMeanSendRate in interface MessageChannelMetricspublic double getMeanErrorRate()
getMeanErrorRate in interface MessageChannelMetricspublic double getMeanErrorRatio()
getMeanErrorRatio in interface MessageChannelMetricspublic double getMeanSendDuration()
getMeanSendDuration in interface MessageChannelMetricspublic double getMinSendDuration()
getMinSendDuration in interface MessageChannelMetricspublic double getMaxSendDuration()
getMaxSendDuration in interface MessageChannelMetricspublic double getStandardDeviationSendDuration()
getStandardDeviationSendDuration in interface MessageChannelMetricspublic Statistics getSendDuration()
getSendDuration in interface MessageChannelMetricspublic Statistics getSendRate()
getSendRate in interface MessageChannelMetricspublic Statistics getErrorRate()
getErrorRate in interface MessageChannelMetricspublic IntegrationManagement.ManagementOverrides getOverrides()
IntegrationManagementgetOverrides in interface IntegrationManagementprotected void onInit()
throws java.lang.Exception
IntegrationObjectSupportonInit in class IntegrationObjectSupportjava.lang.Exception - Any exception.public java.lang.String getFullChannelName()
public boolean send(org.springframework.messaging.Message<?> message)
send in interface org.springframework.messaging.MessageChannelmessage - the Message to sendtrue if the message is sent successfully or
false if the sending thread is interrupted.public boolean send(org.springframework.messaging.Message<?> message,
long timeout)
send(Message)).send in interface org.springframework.messaging.MessageChannelmessage - the Message to sendtimeout - the timeout in millisecondstrue if the message is sent successfully,
false if the message cannot be sent within the allotted
time or the sending thread is interrupted.protected abstract boolean doSend(org.springframework.messaging.Message<?> message,
long timeout)
message - The message.timeout - The timeout.