Interface Queue

All Superinterfaces:
org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
All Known Subinterfaces:
MonitorableQueue
All Known Implementing Classes:
AbstractQueue, AbstractRedisQueue, InMemoryQueue, JedisClusterQueue, JedisQueue, RedisQueue

public interface Queue extends org.springframework.context.SmartLifecycle
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
    static interface 
    The callback parameter type passed to [Queue.poll].
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The maximum number of times an un-acknowledged message will be retried before failing permanently.

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Method Summary

    Modifier and Type
    Method
    Description
    Denotes a queue implementation capable of processing multiple messages per poll.
    default void
    Used for testing zombie executions.
    The expired time after which un-acknowledged messages will be retried.
    A handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.
     
    default void
    poll(int maxMessages, Queue.QueueCallback callback)
    Polls the queue for ready messages, processing up-to [maxMessages].
    void
    Polls the queue for ready messages.
    default void
    push(Message message)
    Push [message] for immediate delivery.
    void
    push(Message message, TemporalAmount delay)
    Push [message] for delivery after [delay].
    default void
    Check for any un-acknowledged messages that are overdue and move them back onto the queue.

    Methods inherited from interface org.springframework.context.Lifecycle

    isRunning, start, stop

    Methods inherited from interface org.springframework.context.SmartLifecycle

    getPhase, isAutoStartup, stop
  • Field Details

    • MAX_RETRIES

      static final int MAX_RETRIES
      The maximum number of times an un-acknowledged message will be retried before failing permanently.
      See Also:
  • Method Details

    • getName

      String getName()
    • poll

      void poll(Queue.QueueCallback callback)
      Polls the queue for ready messages.

      Implementations may invoke [callback] any number of times. Some implementations may deliver a maximum of one message per call, others may deliver all ready messages.

      If no messages exist on the queue or all messages have a remaining delay [callback] is not invoked.

      Messages *must* be acknowledged by calling the function passed to [callback] or they will be retried after [ackTimeout]. Acknowledging via a nested callback allows the message to be processed asynchronously.

      Parameters:
      callback - invoked with the next message from the queue if there is one and an _acknowledge_ function to call once processing is complete.
    • poll

      default void poll(int maxMessages, Queue.QueueCallback callback)
      Polls the queue for ready messages, processing up-to [maxMessages].
    • push

      default void push(Message message)
      Push [message] for immediate delivery.
    • push

      void push(Message message, TemporalAmount delay)
      Push [message] for delivery after [delay].
    • retry

      default void retry()
      Check for any un-acknowledged messages that are overdue and move them back onto the queue.

      This method is not intended to be called by clients directly but typically scheduled in some way.

    • clear

      default void clear()
      Used for testing zombie executions. Wipes all messages from the queue.
    • getAckTimeout

      TemporalAmount getAckTimeout()
      The expired time after which un-acknowledged messages will be retried.
    • getDeadMessageHandlers

      List<Queue.DeadMessageCallback> getDeadMessageHandlers()
      A handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.
    • canPollMany

      Boolean canPollMany()
      Denotes a queue implementation capable of processing multiple messages per poll.