Class AbstractRedisQueue<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:
RedisQueue

public abstract class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands> extends AbstractQueue implements MonitorableQueue
  • Field Details

    • lockTtlSeconds

      protected final Integer lockTtlSeconds
    • mapper

      protected final com.fasterxml.jackson.databind.ObjectMapper mapper
    • READ_MESSAGE_SRC

      protected static final String READ_MESSAGE_SRC
      See Also:
    • READ_MESSAGE_WITH_LOCK_SRC

      protected static final String READ_MESSAGE_WITH_LOCK_SRC
      See Also:
  • Constructor Details

  • Method Details

    • getQueueKey

      protected abstract String getQueueKey()
    • getUnackedKey

      protected abstract String getUnackedKey()
    • getMessagesKey

      protected abstract String getMessagesKey()
    • getLocksKey

      protected abstract String getLocksKey()
    • getAttemptsKey

      protected abstract String getAttemptsKey()
    • cacheScript

      public abstract void cacheScript()
    • getReadMessageWithLockScriptSha

      protected abstract String getReadMessageWithLockScriptSha()
    • setReadMessageWithLockScriptSha

      protected abstract void setReadMessageWithLockScriptSha(String sha)
    • withJedis

      protected abstract <T> T withJedis(Function<CLIENT,T> function)
    • withJedis

      protected void withJedis(Consumer<CLIENT> consumer)
    • getAckTimeout

      public TemporalAmount getAckTimeout()
      Description copied from interface: Queue
      The expired time after which un-acknowledged messages will be retried.
      Specified by:
      getAckTimeout in interface Queue
    • getDeadMessageHandlers

      public List<Queue.DeadMessageCallback> getDeadMessageHandlers()
      Description copied from interface: Queue
      A handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.
      Specified by:
      getDeadMessageHandlers in interface Queue
    • canPollMany

      public Boolean canPollMany()
      Description copied from interface: Queue
      Denotes a queue implementation capable of processing multiple messages per poll.
      Specified by:
      canPollMany in interface Queue
    • getPublisher

      public EventPublisher getPublisher()
      Specified by:
      getPublisher in interface MonitorableQueue
    • handleDeadMessage

      protected void handleDeadMessage(Message message)
    • score

      protected double score()
      Returns:
      current time (plus optional delay) converted to a score for a Redis sorted set.
    • score

      protected double score(TemporalAmount delay)
    • multi

      protected abstract <E extends Throwable> List<Object> multi(cn.sliew.milky.common.function.CheckedConsumer<redis.clients.jedis.Transaction,E> block)
    • hgetInt

      protected int hgetInt(String key, String field)
    • hgetInt

      protected int hgetInt(String key, String field, int defaultValue)
    • zismember

      protected boolean zismember(redis.clients.jedis.commands.JedisCommands commands, String key, String member)
    • anyZismember

      protected boolean anyZismember(redis.clients.jedis.commands.JedisCommands commands, String key, Set<String> members)
    • firstFingerprint

      protected String firstFingerprint(String key, AbstractRedisQueue.Fingerprint fingerprint)
    • hashV1

      @Deprecated protected String hashV1(Message message)
      Deprecated.
      Hashes the attributes property, which is mutable
    • hashV2

      protected String hashV2(Message message)
    • fingerprint

      protected AbstractRedisQueue.Fingerprint fingerprint(Message message)