Class RedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>

All Implemented Interfaces:
MonitorableQueue, Queue, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
JedisClusterQueue, JedisQueue

public abstract class RedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands> extends AbstractRedisQueue<CLIENT>
  • Constructor Details

  • Method Details

    • getQueueKey

      protected String getQueueKey()
      Specified by:
      getQueueKey in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • getUnackedKey

      protected String getUnackedKey()
      Specified by:
      getUnackedKey in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • getMessagesKey

      protected String getMessagesKey()
      Specified by:
      getMessagesKey in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • getLocksKey

      protected String getLocksKey()
      Specified by:
      getLocksKey in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • getAttemptsKey

      protected String getAttemptsKey()
      Specified by:
      getAttemptsKey in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • getReadMessageWithLockScriptSha

      protected String getReadMessageWithLockScriptSha()
      Specified by:
      getReadMessageWithLockScriptSha in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • setReadMessageWithLockScriptSha

      protected void setReadMessageWithLockScriptSha(String sha)
      Specified by:
      setReadMessageWithLockScriptSha in class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
    • poll

      public void poll(Queue.QueueCallback callback)
      Description copied from interface: Queue
      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

      public void poll(int maxMessages, Queue.QueueCallback callback)
      Description copied from interface: Queue
      Polls the queue for ready messages, processing up-to [maxMessages].
    • push

      public void push(Message message, TemporalAmount delay)
      Description copied from interface: Queue
      Push [message] for delivery after [delay].
    • retry

      @Scheduled(fixedDelayString="${queue.retry.frequency.ms:10000}") public void retry()
      Description copied from interface: Queue
      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.

    • readState

      public MonitorableQueue.QueueState readState()
    • containsMessage

      public boolean containsMessage(Predicate<Message> predicate)
    • queueMessage

      protected void queueMessage(Message message, TemporalAmount delay)
    • requeueMessage

      protected void requeueMessage(String fingerprint)
    • removeMessage

      protected void removeMessage(String fingerprint)
    • readMessageWithoutLock

      protected void readMessageWithoutLock(String fingerprint, Consumer<Message> block)
    • readMessageWithLock

      protected org.apache.commons.lang3.tuple.Triple<String,Instant,String> readMessageWithLock()
    • readMessage

      protected void readMessage(String fingerprint, String json, Consumer<Message> block)