List of usage examples for org.springframework.data.redis.connection.jedis JedisMessageListener JedisMessageListener
JedisMessageListener(MessageListener listener)
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 ww w . j a v a 2 s . c o m*/ 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 ww w . j a va 2s . c o m*/ try { BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener); subscription = new JedisSubscription(listener, jedisPubSub, null, patterns); cluster.psubscribe(jedisPubSub, patterns); } catch (Exception ex) { throw convertJedisAccessException(ex); } }