org.springframework.data.redis.connection.RedisConnection.bRPop()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.springframework.data.redis.connection.RedisConnection.bRPop方法的一些代码示例,展示了RedisConnection.bRPop的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisConnection.bRPop方法的具体详情如下:
包路径:org.springframework.data.redis.connection.RedisConnection
类名称:RedisConnection
方法名:bRPop

RedisConnection.bRPop介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
  protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
    List<byte[]> bRPop = connection.bRPop(tm, rawKey);
    return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1));
  }
}, true);

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public List<byte[]> bRPop(int timeout, byte[]... keys) {
  return convertAndReturn(delegate.bRPop(timeout, keys), identityConverter);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public List<String> bRPop(int timeout, String... keys) {
  return convertAndReturn(delegate.bRPop(timeout, serializeMulti(keys)), byteListToStringList);
}

代码示例来源:origin: 1991wangliang/tx-lcn

@Override
public List<byte[]> bRPop(int timeout, byte[]... keys) {
  return redisConnection.bRPop(timeout, keys);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
  protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
    List<byte[]> bRPop = connection.bRPop(tm, rawKey);
    return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1));
  }
}, true);

代码示例来源:origin: apache/servicemix-bundles

@Override
  protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
    List<byte[]> bRPop = connection.bRPop(tm, rawKey);
    return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1));
  }
}, true);

代码示例来源:origin: apache/servicemix-bundles

@Override
public List<byte[]> bRPop(int timeout, byte[]... keys) {
  return convertAndReturn(delegate.bRPop(timeout, keys), identityConverter);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public List<byte[]> bRPop(int timeout, byte[]... keys) {
  return convertAndReturn(delegate.bRPop(timeout, keys), identityConverter);
}

代码示例来源:origin: gudaoxuri/dew

@Override
  protected void doResponse(String address, Consumer<String> consumer) {
    new Thread(() -> redisTemplate.execute((RedisCallback<Void>) connection -> {
      while (!connection.isClosed()) {
        List<byte[]> messages = connection.bRPop(30, address.getBytes());
        if (messages == null) {
          continue;
        }
        String message = new String(messages.get(1), StandardCharsets.UTF_8);
        consumer.accept(message);
      }
      return null;
    })).start();
  }
}

代码示例来源:origin: aillamsun/devX

@Override
  public void response(String address, Consumer<String> consumer) {
    new Thread(() -> redisTemplate.execute((RedisCallback<Void>) connection -> {
          try {
            while (!connection.isClosed()) {
              List<byte[]> messages = connection.bRPop(30, address.getBytes());
              if (messages == null) {
                continue;
              }
              String message = new String(messages.get(1), "UTF-8");
              logger.trace("[MQ] response {}:{}", address, message);
              consumer.accept(message);
            }
          } catch (Exception e) {
            logger.error("Redis Response error.", e);
          }
          return null;
        }
    )).start();
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public List<String> bRPop(int timeout, String... keys) {
  return convertAndReturn(delegate.bRPop(timeout, serializeMulti(keys)), byteListToStringList);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public List<String> bRPop(int timeout, String... keys) {
  return convertAndReturn(delegate.bRPop(timeout, serializeMulti(keys)), byteListToStringList);
}

代码示例来源:origin: com.ecfront.dew/cluster-spi-redis

@Override
public void response(String address, Consumer<String> consumer) {
  new Thread(() -> {
    RedisConnection connection = null;
    try {
      connection = redisTemplate.getConnectionFactory().getConnection();
      while (!connection.isClosed()) {
        List<byte[]> messages = connection.bRPop(30, address.getBytes());
        if (messages == null) {
          continue;
        }
        String message = new String(messages.get(1), "UTF-8");
        logger.trace("[MQ] response {}:{}", address, message);
        consumer.accept(message);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (connection != null && !connection.isClosed()) {
        connection.close();
      }
    }
  }).start();
}

相关文章

微信公众号

最新文章

更多

RedisConnection类方法