public abstract class AbstractMessageChannel extends IntegrationObjectSupport implements MessageChannel, TrackableComponent
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 class |
AbstractMessageChannel.ChannelInterceptorList
A convenience wrapper class for the list of ChannelInterceptors.
|
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
AbstractMessageChannel() |
Modifier and Type | Method and Description |
---|---|
void |
addInterceptor(ChannelInterceptor interceptor)
Add a channel interceptor to the end of the list.
|
protected abstract boolean |
doSend(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 |
getInterceptors()
Exposes the interceptor list for subclasses.
|
boolean |
send(Message<?> message)
Send a message on this channel.
|
boolean |
send(Message<?> message,
long timeout)
Send a message on this channel.
|
void |
setConversionService(org.springframework.core.convert.ConversionService conversionService)
Specify the
ConversionService to use when trying to convert to
one of this channel's supported datatypes for a Message whose payload
does not already match. |
void |
setDatatypes(java.lang.Class<?>... datatypes)
Specify the Message payload datatype(s) supported by this channel.
|
void |
setInterceptors(java.util.List<ChannelInterceptor> interceptors)
Set the list of channel interceptors.
|
void |
setShouldTrack(boolean shouldTrack) |
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public java.lang.String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class IntegrationObjectSupport
public void setShouldTrack(boolean shouldTrack)
setShouldTrack
in interface TrackableComponent
public void setDatatypes(java.lang.Class<?>... datatypes)
If this property is not set explicitly, any Message payload type will be accepted.
public void setInterceptors(java.util.List<ChannelInterceptor> interceptors)
public void addInterceptor(ChannelInterceptor interceptor)
public void setConversionService(org.springframework.core.convert.ConversionService conversionService)
ConversionService
to use when trying to convert to
one of this channel's supported datatypes for a Message whose payload
does not already match. If this property is not set explicitly but
the channel is managed within a context, it will attempt to locate a
bean named "integrationConversionService" defined within that context.
Finally, if that bean is not available, it will fallback to the
"conversionService" bean, if available.setConversionService
in class IntegrationObjectSupport
protected AbstractMessageChannel.ChannelInterceptorList getInterceptors()
public java.lang.String getFullChannelName()
public final boolean send(Message<?> message)
send
in interface MessageChannel
message
- the Message to sendtrue
if the message is sent successfully or
false
if the sending thread is interrupted.public final boolean send(Message<?> message, long timeout)
send(Message)
).send
in interface MessageChannel
message
- 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(Message<?> message, long timeout)