@IntegrationManagedResource public abstract class AbstractMessageChannel extends IntegrationObjectSupport implements org.springframework.messaging.MessageChannel, TrackableComponent, org.springframework.messaging.support.InterceptableChannel, MessageChannelMetrics, ConfigurableMetricsAware<AbstractMessageChannelMetrics>, IntegrationPattern
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 |
protected java.util.Set<MeterFacade> |
meters |
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)
Deprecated.
in favor of Micrometer metrics.
|
void |
destroy() |
protected abstract boolean |
doSend(org.springframework.messaging.Message<?> message,
long timeout)
Subclasses must implement this method.
|
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
Statistics |
getErrorRate()
Deprecated.
in favor of Micrometer metrics.
|
java.lang.String |
getFullChannelName()
Returns the fully qualified channel name including the application context
id, if available.
|
protected AbstractMessageChannel.ChannelInterceptorList |
getIChannelInterceptorList()
Exposes the interceptor list instance for subclasses.
|
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
java.util.List<org.springframework.messaging.support.ChannelInterceptor> |
getInterceptors()
Return a read-only list of the configured interceptors.
|
double |
getMaxSendDuration()
Deprecated.
in favor of Micrometer metrics.
|
double |
getMeanErrorRate()
Deprecated.
in favor of Micrometer metrics.
|
double |
getMeanErrorRatio()
Deprecated.
in favor of Micrometer metrics.
|
double |
getMeanSendDuration()
Deprecated.
in favor of Micrometer metrics.
|
double |
getMeanSendRate()
Deprecated.
in favor of Micrometer metrics.
|
protected AbstractMessageChannelMetrics |
getMetrics()
Deprecated.
in favor of Micrometer metrics.
|
protected MetricsCaptor |
getMetricsCaptor() |
double |
getMinSendDuration()
Deprecated.
in favor of Micrometer metrics.
|
IntegrationManagement.ManagementOverrides |
getOverrides()
Return the overrides.
|
int |
getSendCount()
Deprecated.
in favor of Micrometer metrics.
|
long |
getSendCountLong()
Deprecated.
in favor of Micrometer metrics.
|
Statistics |
getSendDuration()
Deprecated.
in favor of Micrometer metrics.
|
int |
getSendErrorCount()
Deprecated.
in favor of Micrometer metrics.
|
long |
getSendErrorCountLong()
Deprecated.
in favor of Micrometer metrics.
|
Statistics |
getSendRate()
Deprecated.
in favor of Micrometer metrics.
|
double |
getStandardDeviationSendDuration()
Deprecated.
in favor of Micrometer metrics.
|
double |
getTimeSinceLastSend()
Deprecated.
in favor of Micrometer metrics.
|
boolean |
isCountsEnabled()
Deprecated.
|
boolean |
isLoggingEnabled() |
boolean |
isStatsEnabled() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
registerMetricsCaptor(MetricsCaptor metricsCaptorToRegister)
Inject a
MetricsCaptor |
boolean |
removeInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor) |
org.springframework.messaging.support.ChannelInterceptor |
removeInterceptor(int index) |
void |
reset()
Deprecated.
in favor of Micrometer metrics.
|
boolean |
send(org.springframework.messaging.Message<?> message)
Send a message on this channel.
|
boolean |
send(org.springframework.messaging.Message<?> messageArg,
long timeout)
Send a message on this channel.
|
void |
setCountsEnabled(boolean countsEnabled)
Deprecated.
|
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, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanName, getComponentNamesendCount, sendErrorCountprotected final AbstractMessageChannel.ChannelInterceptorList interceptors
protected final java.util.Set<MeterFacade> meters
public java.lang.String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic IntegrationPatternType getIntegrationPatternType()
IntegrationPatterngetIntegrationPatternType in interface IntegrationPatternIntegrationPatternType this component implements.public void setShouldTrack(boolean shouldTrack)
setShouldTrack in interface TrackableComponentpublic void registerMetricsCaptor(MetricsCaptor metricsCaptorToRegister)
IntegrationManagementMetricsCaptorregisterMetricsCaptor in interface IntegrationManagementmetricsCaptorToRegister - the captor.@Nullable protected MetricsCaptor getMetricsCaptor()
public void setCountsEnabled(boolean countsEnabled)
IntegrationManagementsetCountsEnabled in interface IntegrationManagementcountsEnabled - the countsEnabledpublic boolean isCountsEnabled()
IntegrationManagementisCountsEnabled 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 IntegrationManagement@Deprecated protected AbstractMessageChannelMetrics getMetrics()
@Deprecated public void configureMetrics(AbstractMessageChannelMetrics metrics)
configureMetrics in interface ConfigurableMetricsAware<AbstractMessageChannelMetrics>metrics - the metricspublic 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 org.springframework.messaging.support.InterceptableChannelinterceptors - The list of interceptors.public void addInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
addInterceptor in interface org.springframework.messaging.support.InterceptableChannelinterceptor - The interceptor.public void addInterceptor(int index,
org.springframework.messaging.support.ChannelInterceptor interceptor)
addInterceptor in interface org.springframework.messaging.support.InterceptableChannelindex - 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> getInterceptors()
getInterceptors in interface org.springframework.messaging.support.InterceptableChannelpublic boolean removeInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor)
removeInterceptor in interface org.springframework.messaging.support.InterceptableChannel@Nullable public org.springframework.messaging.support.ChannelInterceptor removeInterceptor(int index)
removeInterceptor in interface org.springframework.messaging.support.InterceptableChannelprotected AbstractMessageChannel.ChannelInterceptorList getIChannelInterceptorList()
@Deprecated public void reset()
reset in interface IntegrationManagement@Deprecated public int getSendCount()
getSendCount in interface MessageChannelMetrics@Deprecated public long getSendCountLong()
getSendCountLong in interface MessageChannelMetrics@Deprecated public int getSendErrorCount()
getSendErrorCount in interface MessageChannelMetrics@Deprecated public long getSendErrorCountLong()
getSendErrorCountLong in interface MessageChannelMetrics@Deprecated public double getTimeSinceLastSend()
getTimeSinceLastSend in interface MessageChannelMetrics@Deprecated public double getMeanSendRate()
getMeanSendRate in interface MessageChannelMetrics@Deprecated public double getMeanErrorRate()
getMeanErrorRate in interface MessageChannelMetrics@Deprecated public double getMeanErrorRatio()
getMeanErrorRatio in interface MessageChannelMetrics@Deprecated public double getMeanSendDuration()
getMeanSendDuration in interface MessageChannelMetrics@Deprecated public double getMinSendDuration()
getMinSendDuration in interface MessageChannelMetrics@Deprecated public double getMaxSendDuration()
getMaxSendDuration in interface MessageChannelMetrics@Deprecated public double getStandardDeviationSendDuration()
getStandardDeviationSendDuration in interface MessageChannelMetrics@Deprecated public Statistics getSendDuration()
getSendDuration in interface MessageChannelMetrics@Deprecated public Statistics getSendRate()
getSendRate in interface MessageChannelMetrics@Deprecated public Statistics getErrorRate()
getErrorRate in interface MessageChannelMetricspublic IntegrationManagement.ManagementOverrides getOverrides()
IntegrationManagementgetOverrides in interface IntegrationManagementprotected void onInit()
IntegrationObjectSupportonInit in class IntegrationObjectSupportpublic 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<?> messageArg,
long timeout)
send(Message)).send in interface org.springframework.messaging.MessageChannelmessageArg - 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.public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeandestroy in interface IntegrationManagement