org.springframework.data.redis.connection
Interface Subscription

All Known Implementing Classes:
AbstractSubscription

public interface Subscription

Subscription for Redis channels. Just like the underlying RedisConnection, it should not be used by multiple threads. Note that once a subscription died, it cannot accept any more subscriptions.


Method Summary
 Collection<byte[]> getChannels()
          Returns the (named) channels for this subscription.
 MessageListener getListener()
          Returns the listener used for this subscription.
 Collection<byte[]> getPatterns()
          Returns the channel patters for this subscription.
 boolean isAlive()
          Indicates whether this subscription is still 'alive' or not.
 void pSubscribe(byte[]... patterns)
          Adds the given channel patterns to the current subscription.
 void pUnsubscribe()
          Cancels the subscription for all channels matched by patterns.
 void pUnsubscribe(byte[]... patterns)
          Cancels the subscription for all channels matching the given patterns.
 void subscribe(byte[]... channels)
          Adds the given channels to the current subscription.
 void unsubscribe()
          Cancels the current subscription for all channels given by name.
 void unsubscribe(byte[]... channels)
          Cancels the current subscription for all given channels.
 

Method Detail

subscribe

void subscribe(byte[]... channels)
               throws RedisInvalidSubscriptionException
Adds the given channels to the current subscription.

Parameters:
channels - channel names
Throws:
RedisInvalidSubscriptionException

pSubscribe

void pSubscribe(byte[]... patterns)
                throws RedisInvalidSubscriptionException
Adds the given channel patterns to the current subscription.

Parameters:
patterns - channel patterns
Throws:
RedisInvalidSubscriptionException

unsubscribe

void unsubscribe()
Cancels the current subscription for all channels given by name.


unsubscribe

void unsubscribe(byte[]... channels)
Cancels the current subscription for all given channels.

Parameters:
channels - channel names

pUnsubscribe

void pUnsubscribe()
Cancels the subscription for all channels matched by patterns.


pUnsubscribe

void pUnsubscribe(byte[]... patterns)
Cancels the subscription for all channels matching the given patterns.

Parameters:
patterns -

getChannels

Collection<byte[]> getChannels()
Returns the (named) channels for this subscription.

Returns:
collection of named channels

getPatterns

Collection<byte[]> getPatterns()
Returns the channel patters for this subscription.

Returns:
collection of channel patterns

getListener

MessageListener getListener()
Returns the listener used for this subscription.

Returns:
the listener used for this subscription.

isAlive

boolean isAlive()
Indicates whether this subscription is still 'alive' or not.

Returns:
true if the subscription still applies, false otherwise.