@IntegrationManagedResource public abstract class AbstractMessageChannel extends IntegrationObjectSupport implements org.springframework.messaging.MessageChannel, TrackableComponent, org.springframework.messaging.support.InterceptableChannel, IntegrationManagement, 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 |
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.
|
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.
|
protected MetricsCaptor |
getMetricsCaptor() |
IntegrationManagement.ManagementOverrides |
getOverrides()
Return the overrides.
|
boolean |
isLoggingEnabled()
Return whether logging is enabled.
|
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) |
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 |
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)
Enable logging or not.
|
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) |
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, waitgetManagedName, getManagedType, getThisAs, setManagedName, setManagedTypegetBeanName, getComponentNameprotected 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 boolean isLoggingEnabled()
IntegrationManagementisLoggingEnabled in interface IntegrationManagementpublic void setLoggingEnabled(boolean loggingEnabled)
IntegrationManagementsetLoggingEnabled in interface IntegrationManagementloggingEnabled - dalse to disable.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 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()
public 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