Top Description Inners Fields Constructors Methods
org.springframework.messaging.support

public abstract Class AbstractMessageChannel

extends Object
implements MessageChannel, InterceptableChannel, BeanNameAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.Aware, org.springframework.messaging.support.InterceptableChannel, org.springframework.messaging.MessageChannel
Known Direct Subclasses
org.springframework.messaging.support.AbstractSubscribableChannel
Imports
java.util.ArrayList, .Collections, .List, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.BeanNameAware, org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessageChannel, .MessageDeliveryException, .MessagingException, org.springframework.util.Assert, .ObjectUtils

Abstract base class for MessageChannel implementations.
Author
Rossen Stoyanchev
Since
4.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
AbstractMessageChannel.ChannelInterceptorChain

Assists with the invocation of the configured channel interceptors.

Field Summary

Modifier and TypeField and Description
private String
private final List<ChannelInterceptor>
protected Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addInterceptor(ChannelInterceptor interceptor)

Implements org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Add a channel interceptor to the end of the list.
public void
addInterceptor(int index, ChannelInterceptor interceptor)

Implements org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Add a channel interceptor at the specified index.
public String
getBeanName()

Return the bean name for this message channel.

public List<ChannelInterceptor>
public Log
getLogger()

Return the currently configured Logger.

public boolean
public ChannelInterceptor
removeInterceptor(int index)

Implements org.springframework.messaging.support.InterceptableChannel.removeInterceptor.

Remove the interceptor at the given index.
public final boolean
send(Message<?>
the message to send
message
)

Overrides default org.springframework.messaging.MessageChannel.send.

Send a Message to this channel.
public final boolean
send(Message<?>
the message to send
message
,
long
the timeout in milliseconds or INDEFINITE_TIMEOUT
timeout
)

Implements org.springframework.messaging.MessageChannel.send.

Send a message, blocking until either the message is accepted or the specified timeout period elapses.
protected abstract boolean
sendInternal(Message<?> message, long timeout)

public void
setBeanName(String
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.
name
)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

A message channel uses the bean name primarily for logging purposes.
public void
setInterceptors(List<ChannelInterceptor> interceptors)

Implements org.springframework.messaging.support.InterceptableChannel.setInterceptors.

Set the list of channel interceptors clearing any existing interceptors.
public void
setLogger(Log
the logger to use
logger
)

Set an alternative logger to use than the one based on the class name.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

beanNameback to summary
private String beanName
interceptorsback to summary
private final List<ChannelInterceptor> interceptors
loggerback to summary
protected Log logger

Constructor Detail

AbstractMessageChannelback to summary
public AbstractMessageChannel()

Method Detail

addInterceptorback to summary
public void addInterceptor(ChannelInterceptor interceptor)

Implements org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Doc from org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Add a channel interceptor to the end of the list.

Annotations
@Override
addInterceptorback to summary
public void addInterceptor(int index, ChannelInterceptor interceptor)

Implements org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Doc from org.springframework.messaging.support.InterceptableChannel.addInterceptor.

Add a channel interceptor at the specified index.

Annotations
@Override
getBeanNameback to summary
public String getBeanName()

Return the bean name for this message channel.

getInterceptorsback to summary
public List<ChannelInterceptor> getInterceptors()

Implements org.springframework.messaging.support.InterceptableChannel.getInterceptors.

Doc from org.springframework.messaging.support.InterceptableChannel.getInterceptors.

Return the list of configured interceptors.

Annotations
@Override
getLoggerback to summary
public Log getLogger()

Return the currently configured Logger.

Since
5.1
removeInterceptorback to summary
public boolean removeInterceptor(ChannelInterceptor interceptor)

Implements org.springframework.messaging.support.InterceptableChannel.removeInterceptor.

Doc from org.springframework.messaging.support.InterceptableChannel.removeInterceptor.

Remove the given interceptor.

Annotations
@Override
removeInterceptorback to summary
public ChannelInterceptor removeInterceptor(int index)

Implements org.springframework.messaging.support.InterceptableChannel.removeInterceptor.

Doc from org.springframework.messaging.support.InterceptableChannel.removeInterceptor.

Remove the interceptor at the given index.

Annotations
@Override
sendback to summary
public final boolean send(Message<?> message)

Overrides default org.springframework.messaging.MessageChannel.send.

Doc from org.springframework.messaging.MessageChannel.send.

Send a Message to this channel. If the message is sent successfully, the method returns true. If the message cannot be sent due to a non-fatal reason, the method returns false. 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 send(Message, long).

Parameters
message:Message<?>

the message to send

Returns:boolean

whether the message was sent

Annotations
@Override
sendback to summary
public final boolean send(Message<?> message, long timeout)

Implements org.springframework.messaging.MessageChannel.send.

Doc from org.springframework.messaging.MessageChannel.send.

Send a message, blocking until either the message is accepted or the specified timeout period elapses.

Parameters
message:Message<?>

the message to send

timeout:long

the timeout in milliseconds or INDEFINITE_TIMEOUT

Returns:boolean

true if the message is sent, false if not including a timeout of an interrupt of the send

Annotations
@Override
sendInternalback to summary
protected abstract boolean sendInternal(Message<?> message, long timeout)
setBeanNameback to summary
public void setBeanName(String name)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

A message channel uses the bean name primarily for logging purposes.

Parameters
name:String

Doc from org.springframework.beans.factory.BeanNameAware.setBeanName.

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.

Annotations
@Override
setInterceptorsback to summary
public void setInterceptors(List<ChannelInterceptor> interceptors)

Implements org.springframework.messaging.support.InterceptableChannel.setInterceptors.

Doc from org.springframework.messaging.support.InterceptableChannel.setInterceptors.

Set the list of channel interceptors clearing any existing interceptors.

Annotations
@Override
setLoggerback to summary
public void setLogger(Log logger)

Set an alternative logger to use than the one based on the class name.

Parameters
logger:Log

the logger to use

Since
5.1
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.springframework.messaging.support back to summary

protected Class AbstractMessageChannel.ChannelInterceptorChain

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.messaging.support.AbstractMessageChannel.ChannelInterceptorChain

Assists with the invocation of the configured channel interceptors.

Field Summary

Modifier and TypeField and Description
private int
private int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Message<?>
public void
applyPostSend(Message<?> message, MessageChannel channel, boolean sent)

public boolean
public Message<?>
applyPreSend(Message<?> message, MessageChannel channel)

public void
public void
triggerAfterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

receiveInterceptorIndexback to summary
private int receiveInterceptorIndex
sendInterceptorIndexback to summary
private int sendInterceptorIndex

Constructor Detail

ChannelInterceptorChainback to summary
protected ChannelInterceptorChain()

Method Detail

applyPostReceiveback to summary
public Message<?> applyPostReceive(Message<?> message, MessageChannel channel)
Annotations
@Nullable
applyPostSendback to summary
public void applyPostSend(Message<?> message, MessageChannel channel, boolean sent)
applyPreReceiveback to summary
public boolean applyPreReceive(MessageChannel channel)
applyPreSendback to summary
public Message<?> applyPreSend(Message<?> message, MessageChannel channel)
Annotations
@Nullable
triggerAfterReceiveCompletionback to summary
public void triggerAfterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex)
triggerAfterSendCompletionback to summary
public void triggerAfterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex)