Class AbstractSubscribableChannel

java.lang.Object
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, SubscribableChannelManagement, TrackableComponent, org.springframework.messaging.MessageChannel, org.springframework.messaging.SubscribableChannel, org.springframework.messaging.support.InterceptableChannel
Direct Known Subclasses:
AbstractExecutorChannel, DirectChannel

public abstract class AbstractSubscribableChannel
extends AbstractMessageChannel
implements org.springframework.messaging.SubscribableChannel, SubscribableChannelManagement
Base implementation of MessageChannel that invokes the subscribed handler(s) by delegating to a MessageDispatcher.
  • Constructor Details

  • Method Details

    • getSubscriberCount

      public int getSubscriberCount()
      Description copied from interface: SubscribableChannelManagement
      The number of message handlers currently subscribed to this channel.
      Specified by:
      getSubscriberCount in interface SubscribableChannelManagement
      Returns:
      the number of subscribers.
    • subscribe

      public boolean subscribe​(org.springframework.messaging.MessageHandler handler)
      Specified by:
      subscribe in interface org.springframework.messaging.SubscribableChannel
    • unsubscribe

      public boolean unsubscribe​(org.springframework.messaging.MessageHandler handle)
      Specified by:
      unsubscribe in interface org.springframework.messaging.SubscribableChannel
    • doSend

      protected boolean doSend​(org.springframework.messaging.Message<?> message, long timeout)
      Description copied from class: AbstractMessageChannel
      Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.
      Specified by:
      doSend in class AbstractMessageChannel
      Parameters:
      message - The message.
      timeout - The timeout.
      Returns:
      true if the send was successful.
    • getDispatcher

      protected abstract MessageDispatcher getDispatcher()