Java Code Examples for redis.clients.jedis.JedisCluster#publish()

The following examples show how to use redis.clients.jedis.JedisCluster#publish() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisShardBackplane.java    From bazel-buildfarm with Apache License 2.0 5 votes vote down vote up
void publish(
    JedisCluster jedis,
    String channel,
    Instant effectiveAt,
    OperationChange.Builder operationChange) {
  try {
    String operationChangeJson =
        printOperationChange(
            operationChange.setEffectiveAt(toTimestamp(effectiveAt)).setSource(source).build());
    jedis.publish(channel, operationChangeJson);
  } catch (InvalidProtocolBufferException e) {
    logger.log(Level.SEVERE, "error printing operation change", e);
    // very unlikely, printer would have to fail
  }
}
 
Example 2
Source File: RedisShardBackplane.java    From bazel-buildfarm with Apache License 2.0 5 votes vote down vote up
private boolean removeWorkerAndPublish(JedisCluster jedis, String name, String changeJson) {
  if (jedis.hdel(config.getWorkersHashName(), name) == 1) {
    jedis.publish(config.getWorkerChannel(), changeJson);
    return true;
  }
  return false;
}