Class PriorityChannel

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, ExecutorChannelInterceptorAware, QueueChannelOperations, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, org.springframework.messaging.MessageChannel, org.springframework.messaging.PollableChannel, org.springframework.messaging.support.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'.
  • 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​(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.
      Overrides:
      doSend in class QueueChannel
      Parameters:
      message - The message.
      timeout - The timeout.
      Returns:
      true if the send was successful.
    • doReceive

      protected org.springframework.messaging.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.