Class PriorityChannel

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ExecutorChannelInterceptorAware, QueueChannelOperations, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageChannel, PollableChannel, InterceptableChannel

public class PriorityChannel extends QueueChannel
A message channel that prioritizes messages based on a Comparator. The default comparator is based upon the message header's 'priority'.
Author:
Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan
  • Constructor Details

  • Method Details

    • getRemainingCapacity

      public int getRemainingCapacity()
      Description copied from interface: QueueChannelOperations
      Obtain the remaining capacity of this channel.
      Specified by:
      getRemainingCapacity in interface QueueChannelOperations
      Overrides:
      getRemainingCapacity in class QueueChannel
      Returns:
      The remaining capacity of this channel.
    • 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.
      Overrides:
      doSend in class QueueChannel
      Parameters:
      message - The message.
      timeout - The timeout.
      Returns:
      true if the send was successful.
    • doReceive

      protected Message<?> doReceive(long timeout)
      Description copied from class: AbstractPollableChannel
      Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is empty (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 a message is available or the blocking thread is interrupted.
      Overrides:
      doReceive in class QueueChannel
      Parameters:
      timeout - The timeout.
      Returns:
      The message, or null.