本文整理了Java中redis.clients.jedis.JedisCluster.subscribe()
方法的一些代码示例,展示了JedisCluster.subscribe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JedisCluster.subscribe()
方法的具体详情如下:
包路径:redis.clients.jedis.JedisCluster
类名称:JedisCluster
方法名:subscribe
暂无
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public void subscribe(MessageListener listener, byte[]... channels) {
if (isSubscribed()) {
throw new RedisSubscribedConnectionException(
"Connection already subscribed; use the connection Subscription to cancel or add new channels");
}
try {
BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener);
subscription = new JedisSubscription(listener, jedisPubSub, channels, null);
cluster.subscribe(jedisPubSub, channels);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: org.nutz/nutz-integration-jedis
public void subscribe(JedisPubSub jedisPubSub, String... channels) {
jedisCluster.subscribe(jedisPubSub, channels);
}
代码示例来源:origin: org.nutz/nutz-integration-jedis
public void subscribe(BinaryJedisPubSub jedisPubSub, byte[]... channels) {
jedisCluster.subscribe(jedisPubSub, channels);
}
代码示例来源:origin: dufyun/learn-tech-collection
public void subscribe(final JedisPubSub jedisPubSub, final String... channels) {
jedisCluster.subscribe(jedisPubSub, channels);
}
代码示例来源:origin: yrain/smart-cache
public void subscribe(final JedisPubSub jedisPubSub, final String... channels) {
if (cluster) {
jedisCluster.subscribe(jedisPubSub, channels);
} else {
jedisOperator.subscribe(jedisPubSub, channels);
}
}
代码示例来源:origin: jzyong/game-server
@Override
public void run() {
try {
if (channels != null && channels.length > 0) {
JedisManager.getJedisCluster().subscribe(this, channels);
}
} catch (Exception e) {
LOGGER.error(null, e);
}
}
代码示例来源:origin: yangfuhai/jboot
@Override
public void run() {
while (true) {
//订阅线程断开连接,需要进行重连
try {
jedisCluster.subscribe(binaryListener, channels);
LOG.warn("Disconnect to redis channel in subscribe BinaryJedisPubSub!");
break;
} catch (JedisConnectionException e) {
LOG.error("failed connect to redis, reconnect it.", e);
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
break;
}
}
}
}
}.start();
代码示例来源:origin: yangfuhai/jboot
@Override
public void run() {
while (true) {
//订阅线程断开连接,需要进行重连
try {
jedisCluster.subscribe(listener, channels);
LOG.warn("Disconnect to redis channel in subscribe JedisPubSub!");
break;
} catch (JedisConnectionException e) {
LOG.error("failed connect to redis, reconnect it.", e);
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
break;
}
}
}
}
}.start();
代码示例来源:origin: yrain/smart-cache
public void subscribe(final BinaryJedisPubSub jedisPubSub, final String... channels) {
if (cluster) {
jedisCluster.subscribe(jedisPubSub, convertObjectArrayToByteArray_serializeKey(channels));
} else {
jedisOperator.subscribe(jedisPubSub, convertObjectArrayToByteArray_serializeKey(channels));
}
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@Override
public void subscribe(MessageListener listener, byte[]... channels) {
if (isSubscribed()) {
throw new RedisSubscribedConnectionException(
"Connection already subscribed; use the connection Subscription to cancel or add new channels");
}
try {
BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener);
subscription = new JedisSubscription(listener, jedisPubSub, channels, null);
cluster.subscribe(jedisPubSub, channels);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public void subscribe(MessageListener listener, byte[]... channels) {
if (isSubscribed()) {
throw new RedisSubscribedConnectionException(
"Connection already subscribed; use the connection Subscription to cancel or add new channels");
}
try {
BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener);
subscription = new JedisSubscription(listener, jedisPubSub, channels, null);
cluster.subscribe(jedisPubSub, channels);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!