Example usage for org.springframework.data.redis.connection RedisSubscribedConnectionException RedisSubscribedConnectionException

List of usage examples for org.springframework.data.redis.connection RedisSubscribedConnectionException RedisSubscribedConnectionException

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisSubscribedConnectionException RedisSubscribedConnectionException.

Prototype

public RedisSubscribedConnectionException(String msg) 

Source Link

Document

Constructs a new RedisSubscribedConnectionException instance.

Usage

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@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");
    }//from w w  w.  j av a2s .c om
    try {
        BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener);
        subscription = new JedisSubscription(listener, jedisPubSub, channels, null);
        cluster.subscribe(jedisPubSub, channels);
    } catch (Exception ex) {
        throw convertJedisAccessException(ex);
    }
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void pSubscribe(MessageListener listener, byte[]... patterns) {

    if (isSubscribed()) {
        throw new RedisSubscribedConnectionException(
                "Connection already subscribed; use the connection Subscription to cancel or add new channels");
    }// ww w .  j ava 2s.com
    try {
        BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener);
        subscription = new JedisSubscription(listener, jedisPubSub, null, patterns);
        cluster.psubscribe(jedisPubSub, patterns);
    } catch (Exception ex) {
        throw convertJedisAccessException(ex);
    }
}