Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.publish()


            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hset(key, value, expire);
                    jedis.publish(key, Constants.REGISTER);
                    success = true;
                    if (! replicate) {
                      break; //  如果服务器端已同步数据,只需写入单台机器
                    }
                } finally {
View Full Code Here


            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hdel(key, value);
                    jedis.publish(key, Constants.UNREGISTER);
                    success = true;
                    if (! replicate) {
                      break; //  如果服务器端已同步数据,只需写入单台机器
                    }
                } finally {
View Full Code Here

        } catch (JedisConnectionException e) {
            logger.debug("Could not obtain redis connection from the pool");
            return;
        }
        try {
            jedis.publish("nl.axonframework.examples.addressbook", writer.toString());
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
View Full Code Here

  }

  public void send(String channel, String message) {
    Jedis jedis = redisPool.getResource();
    try {
      jedis.publish(channel, message);
    } catch(Exception e){
      log.warn("Cannot publish the message to redis",e);
    }finally{
      redisPool.returnResource(jedis);
    }
View Full Code Here

  private void publish(final String channel, final String message) {
    Runnable task = new Runnable() {
      public void run() {
        Jedis jedis = redisPool.getResource();
        try {
          jedis.publish(channel, message);
        } catch(Exception e){
          log.warn("Cannot publish the message to redis", e);
        } finally {
          redisPool.returnResource(jedis);
        }       
View Full Code Here

  }
 
  private void publish(String channel, String message) {
    Jedis jedis = redisPool.getResource();
    try {
      jedis.publish(channel, message);
    } catch(Exception e){
      log.warn("Cannot publish the message to redis", e);
    } finally {
      redisPool.returnResource(jedis);
    }
View Full Code Here

  public void send(String channel, String message) {
    Jedis jedis = redisPool.getResource();
    try {
      log.debug("Sending to channel[" + channel + "] message[" + message + "]");
      jedis.publish(channel, message);
    } catch(Exception e){
      log.warn("Cannot publish the message to redis",e);
    }finally{
      redisPool.returnResource(jedis);
    }
View Full Code Here

                try {
                    for (URL url : new HashSet<URL>(getRegistered())) {
                        if (url.getParameter(Constants.DYNAMIC_KEY, true)) {
                            String key = toCategoryPath(url);
                            if (jedis.hset(key, url.toFullString(), String.valueOf(System.currentTimeMillis() + expirePeriod)) == 1) {
                                jedis.publish(key, Constants.REGISTER);
                            }
                        }
                    }
                    if (admin) {
                        clean(jedis);
View Full Code Here

            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hset(key, value, expire);
                    jedis.publish(key, Constants.REGISTER);
                    success = true;
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
View Full Code Here

            JedisPool jedisPool = entry.getValue();
            try {
                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hdel(key, value);
                    jedis.publish(key, Constants.UNREGISTER);
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                exception = new RpcException("Failed to unregister service to redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.