Class AbstractSubscribableChannel

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, SubscribableChannelManagement, TrackableComponent, MessageChannel, SubscribableChannel, InterceptableChannel
Direct Known Subclasses:
AbstractExecutorChannel, DirectChannel, PostgresSubscribableChannel

public abstract class AbstractSubscribableChannel extends AbstractMessageChannel implements SubscribableChannel, SubscribableChannelManagement
Base implementation of MessageChannel that invokes the subscribed handler(s) by delegating to a MessageDispatcher.
Author:
Mark Fisher, Oleg Zhurakousky, Gary Russell, Artme Bilan
  • Constructor Details

    • AbstractSubscribableChannel

      public AbstractSubscribableChannel()
  • 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(MessageHandler handler)
      Specified by:
      subscribe in interface SubscribableChannel
    • unsubscribe

      public boolean unsubscribe(MessageHandler handle)
      Specified by:
      unsubscribe in interface SubscribableChannel
    • doSend

      protected boolean doSend(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()