List of usage examples for org.springframework.data.redis.connection.jedis JedisSubscription JedisSubscription
JedisSubscription(MessageListener listener, BinaryJedisPubSub jedisPubSub, @Nullable byte[][] channels, @Nullable byte[][] patterns)
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 a 2 s.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"); }//from w w w. j a va 2 s. co m try { BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener); subscription = new JedisSubscription(listener, jedisPubSub, null, patterns); cluster.psubscribe(jedisPubSub, patterns); } catch (Exception ex) { throw convertJedisAccessException(ex); } }