类 AbstractMessageChannel
- java.lang.Object
- org.springframework.messaging.support.AbstractMessageChannel
- 所有已实现的接口:
Aware
,BeanNameAware
,MessageChannel
,InterceptableChannel
- 直接已知子类:
AbstractSubscribableChannel
public abstract class AbstractMessageChannel extends Object implements MessageChannel, InterceptableChannel, BeanNameAware
Abstract base class forMessageChannel
implementations.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected class
AbstractMessageChannel.ChannelInterceptorChain
Assists with the invocation of the configured channel interceptors.
字段概要
从接口继承的字段 org.springframework.messaging.MessageChannel
INDEFINITE_TIMEOUT
构造器概要
构造器 构造器 说明 AbstractMessageChannel()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
addInterceptor(int index, ChannelInterceptor interceptor)
Add a channel interceptor at the specified index.void
addInterceptor(ChannelInterceptor interceptor)
Add a channel interceptor to the end of the list.String
getBeanName()
Return the bean name for this message channel.List<ChannelInterceptor>
getInterceptors()
Return the list of configured interceptors.ChannelInterceptor
removeInterceptor(int index)
Remove the interceptor at the given index.boolean
removeInterceptor(ChannelInterceptor interceptor)
Remove the given interceptor.boolean
send(Message<?> message)
Send aMessage
to this channel.boolean
send(Message<?> message, long timeout)
Send a message, blocking until either the message is accepted or the specified timeout period elapses.protected abstract boolean
sendInternal(Message<?> message, long timeout)
void
setBeanName(String name)
A message channel uses the bean name primarily for logging purposes.void
setInterceptors(List<ChannelInterceptor> interceptors)
Set the list of channel interceptors clearing any existing interceptors.String
toString()
构造器详细资料
AbstractMessageChannel
public AbstractMessageChannel()
方法详细资料
setBeanName
public void setBeanName(String name)
A message channel uses the bean name primarily for logging purposes.- 指定者:
setBeanName
在接口中BeanNameAware
- 参数:
name
- the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use theBeanFactoryUtils.originalBeanName(String)
method to extract the original bean name (without suffix), if desired.
getBeanName
public String getBeanName()
Return the bean name for this message channel.
setInterceptors
public void setInterceptors(List<ChannelInterceptor> interceptors)
从接口复制的说明:InterceptableChannel
Set the list of channel interceptors clearing any existing interceptors.- 指定者:
setInterceptors
在接口中InterceptableChannel
addInterceptor
public void addInterceptor(ChannelInterceptor interceptor)
从接口复制的说明:InterceptableChannel
Add a channel interceptor to the end of the list.- 指定者:
addInterceptor
在接口中InterceptableChannel
addInterceptor
public void addInterceptor(int index, ChannelInterceptor interceptor)
从接口复制的说明:InterceptableChannel
Add a channel interceptor at the specified index.- 指定者:
addInterceptor
在接口中InterceptableChannel
getInterceptors
public List<ChannelInterceptor> getInterceptors()
从接口复制的说明:InterceptableChannel
Return the list of configured interceptors.- 指定者:
getInterceptors
在接口中InterceptableChannel
removeInterceptor
public boolean removeInterceptor(ChannelInterceptor interceptor)
从接口复制的说明:InterceptableChannel
Remove the given interceptor.- 指定者:
removeInterceptor
在接口中InterceptableChannel
removeInterceptor
public ChannelInterceptor removeInterceptor(int index)
从接口复制的说明:InterceptableChannel
Remove the interceptor at the given index.- 指定者:
removeInterceptor
在接口中InterceptableChannel
send
public final boolean send(Message<?> message)
从接口复制的说明:MessageChannel
Send aMessage
to this channel. If the message is sent successfully, the method returnstrue
. If the message cannot be sent due to a non-fatal reason, the method returnsfalse
. The method may also throw a RuntimeException in case of non-recoverable errors.This method may block indefinitely, depending on the implementation. To provide a maximum wait time, use
MessageChannel.send(Message, long)
.- 指定者:
send
在接口中MessageChannel
- 参数:
message
- the message to send- 返回:
- whether or not the message was sent
send
public final boolean send(Message<?> message, long timeout)
从接口复制的说明:MessageChannel
Send a message, blocking until either the message is accepted or the specified timeout period elapses.- 指定者:
send
在接口中MessageChannel
- 参数:
message
- the message to sendtimeout
- the timeout in milliseconds orMessageChannel.INDEFINITE_TIMEOUT
- 返回:
true
if the message is sent,false
if not including a timeout of an interrupt of the send
sendInternal
protected abstract boolean sendInternal(Message<?> message, long timeout)