类 AbstractRedisQueueServiceImpl

java.lang.Object
top.zenyoung.service.impl.AbstractRedisQueueServiceImpl
所有已实现的接口:
QueueService

public abstract class AbstractRedisQueueServiceImpl
extends Object
implements QueueService
Redis队列-服务接口实现
版本:
1.0
作者:
yangyong
  • 字段详细资料

  • 构造器详细资料

    • AbstractRedisQueueServiceImpl

      protected AbstractRedisQueueServiceImpl​(@Nonnull org.springframework.data.redis.core.StringRedisTemplate redisTemplate)
      构造函数
      参数:
      redisTemplate - Redis模板
  • 方法详细资料

    • getQueuePrefix

      @Nonnull protected abstract String getQueuePrefix()
      获取队列前缀
      返回:
      队列前缀
    • serializable

      protected abstract <T extends Serializable> String serializable​(@Nonnull T data)
      数据序列化
      类型参数:
      T - 数据类型
      参数:
      data - 数据
      返回:
      序列化结果
    • deserializable

      protected abstract <T extends Serializable> T deserializable​(@Nonnull String json, @Nonnull Class<T> dataClass)
      数据反序列化
      类型参数:
      T - 数据类型
      参数:
      json - 序列化数据
      dataClass - 数据类型Class
      返回:
      数据
    • getRedisQueueKey

      @Nonnull protected String getRedisQueueKey​(@Nonnull String key)
      获取Redis队列键
      参数:
      key - 队列键
      返回:
      Redis队列键
    • pushQueue

      public <T extends Serializable> void pushQueue​(@Nonnull String key, @Nonnull T data)
      从接口复制的说明: QueueService
      数据入队
      指定者:
      pushQueue 在接口中 QueueService
      类型参数:
      T - 队列数据类型
      参数:
      key - 队列键名
      data - 队列数据
    • getReadTimeout

      @Nonnull protected Long getReadTimeout()
      获取读取超时时间(毫秒)
      返回:
      读取超时时间(毫秒)
    • getReadMax

      @Nonnull protected Integer getReadMax()
      获取读取最大数据量
      返回:
      读取最大数据量
    • popQueue

      public <T extends Serializable> int popQueue​(@Nonnull String key, @Nonnull Class<T> dataClass, @Nonnull Consumer<T> consumer)
      从接口复制的说明: QueueService
      数据出队
      指定者:
      popQueue 在接口中 QueueService
      类型参数:
      T - 队列数据类型
      参数:
      key - 队列键名
      dataClass - 队列数据类型Class
      consumer - 出队数据处理
      返回:
      出队数据处理数量