Class AbstractMessageChannel
java.lang.Object
org.springframework.messaging.support.AbstractMessageChannel
- All Implemented Interfaces:
- Aware,- BeanNameAware,- MessageChannel,- InterceptableChannel
- Direct Known Subclasses:
- AbstractSubscribableChannel
public abstract class AbstractMessageChannel
extends Object
implements MessageChannel, InterceptableChannel, BeanNameAware
Abstract base class for 
MessageChannel implementations.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classAssists with the invocation of the configured channel interceptors.
- 
Field SummaryFieldsFields inherited from interface org.springframework.messaging.MessageChannelINDEFINITE_TIMEOUT
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddInterceptor(int index, ChannelInterceptor interceptor) Add a channel interceptor at the specified index.voidaddInterceptor(ChannelInterceptor interceptor) Add a channel interceptor to the end of the list.Return the bean name for this message channel.Return the list of configured interceptors.Return the currently configured Logger.removeInterceptor(int index) Remove the interceptor at the given index.booleanremoveInterceptor(ChannelInterceptor interceptor) Remove the given interceptor.final booleanSend aMessageto this channel.final booleanSend a message, blocking until either the message is accepted or the specified timeout period elapses.protected abstract booleansendInternal(Message<?> message, long timeout) voidsetBeanName(String name) A message channel uses the bean name primarily for logging purposes.voidsetInterceptors(List<ChannelInterceptor> interceptors) Set the list of channel interceptors clearing any existing interceptors.voidSet an alternative logger to use than the one based on the class name.toString()
- 
Field Details- 
logger
 
- 
- 
Constructor Details- 
AbstractMessageChannelpublic AbstractMessageChannel()
 
- 
- 
Method Details- 
setLoggerSet an alternative logger to use than the one based on the class name.- Parameters:
- logger- the logger to use
- Since:
- 5.1
 
- 
getLoggerReturn the currently configured Logger.- Since:
- 5.1
 
- 
setBeanNameA message channel uses the bean name primarily for logging purposes.- Specified by:
- setBeanNamein interface- BeanNameAware
- Parameters:
- 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 the- BeanFactoryUtils.originalBeanName(String)method to extract the original bean name (without suffix), if desired.
 
- 
getBeanNameReturn the bean name for this message channel.
- 
setInterceptorsDescription copied from interface:InterceptableChannelSet the list of channel interceptors clearing any existing interceptors.- Specified by:
- setInterceptorsin interface- InterceptableChannel
 
- 
addInterceptorDescription copied from interface:InterceptableChannelAdd a channel interceptor to the end of the list.- Specified by:
- addInterceptorin interface- InterceptableChannel
 
- 
addInterceptorDescription copied from interface:InterceptableChannelAdd a channel interceptor at the specified index.- Specified by:
- addInterceptorin interface- InterceptableChannel
 
- 
getInterceptorsDescription copied from interface:InterceptableChannelReturn the list of configured interceptors.- Specified by:
- getInterceptorsin interface- InterceptableChannel
 
- 
removeInterceptorDescription copied from interface:InterceptableChannelRemove the given interceptor.- Specified by:
- removeInterceptorin interface- InterceptableChannel
 
- 
removeInterceptorDescription copied from interface:InterceptableChannelRemove the interceptor at the given index.- Specified by:
- removeInterceptorin interface- InterceptableChannel
 
- 
sendDescription copied from interface:MessageChannelSend aMessageto 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).- Specified by:
- sendin interface- MessageChannel
- Parameters:
- message- the message to send
- Returns:
- whether or not the message was sent
 
- 
sendDescription copied from interface:MessageChannelSend a message, blocking until either the message is accepted or the specified timeout period elapses.- Specified by:
- sendin interface- MessageChannel
- Parameters:
- message- the message to send
- timeout- the timeout in milliseconds or- MessageChannel.INDEFINITE_TIMEOUT
- Returns:
- trueif the message is sent,- falseif not including a timeout of an interrupt of the send
 
- 
sendInternal
- 
toString
 
-