Package org.redisson
Class RedissonPatternTopic
- java.lang.Object
-
- org.redisson.RedissonPatternTopic
-
- All Implemented Interfaces:
RPatternTopic
public class RedissonPatternTopic extends Object implements RPatternTopic
Distributed topic implementation. Messages are delivered to all message listeners across Redis cluster.- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRedissonPatternTopic(Codec codec, CommandAsyncExecutor commandExecutor, String name)protectedRedissonPatternTopic(CommandAsyncExecutor commandExecutor, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacquire(AsyncSemaphore semaphore)<T> intaddListener(Class<T> type, PatternMessageListener<T> listener)Subscribes to this topic.intaddListener(PatternStatusListener listener)Subscribes to status changes of this topic<T> RFuture<Integer>addListenerAsync(Class<T> type, PatternMessageListener<T> listener)RFuture<Integer>addListenerAsync(PatternStatusListener listener)List<String>getPatternNames()Get topic channel patternsvoidremoveAllListeners()Removes all listeners from this topicvoidremoveListener(int listenerId)Removes the listener byidfor listening this topicvoidremoveListener(PatternMessageListener<?> listener)Removes the listener by its instanceRFuture<Void>removeListenerAsync(int listenerId)
-
-
-
Constructor Detail
-
RedissonPatternTopic
protected RedissonPatternTopic(CommandAsyncExecutor commandExecutor, String name)
-
RedissonPatternTopic
protected RedissonPatternTopic(Codec codec, CommandAsyncExecutor commandExecutor, String name)
-
-
Method Detail
-
addListener
public int addListener(PatternStatusListener listener)
Description copied from interface:RPatternTopicSubscribes to status changes of this topic- Specified by:
addListenerin interfaceRPatternTopic- Parameters:
listener- - message listener- Returns:
- local JVM unique listener id
- See Also:
StatusListener
-
addListener
public <T> int addListener(Class<T> type, PatternMessageListener<T> listener)
Description copied from interface:RPatternTopicSubscribes to this topic.MessageListener.onMessageis called when any message is published on this topic.- Specified by:
addListenerin interfaceRPatternTopic- Type Parameters:
T- type of message- Parameters:
type- - type of messagelistener- - message listener- Returns:
- local JVM unique listener id
- See Also:
MessageListener
-
addListenerAsync
public RFuture<Integer> addListenerAsync(PatternStatusListener listener)
- Specified by:
addListenerAsyncin interfaceRPatternTopic
-
addListenerAsync
public <T> RFuture<Integer> addListenerAsync(Class<T> type, PatternMessageListener<T> listener)
- Specified by:
addListenerAsyncin interfaceRPatternTopic
-
acquire
protected void acquire(AsyncSemaphore semaphore)
-
removeListenerAsync
public RFuture<Void> removeListenerAsync(int listenerId)
- Specified by:
removeListenerAsyncin interfaceRPatternTopic
-
removeListener
public void removeListener(int listenerId)
Description copied from interface:RPatternTopicRemoves the listener byidfor listening this topic- Specified by:
removeListenerin interfaceRPatternTopic- Parameters:
listenerId- - id of message listener
-
removeAllListeners
public void removeAllListeners()
Description copied from interface:RPatternTopicRemoves all listeners from this topic- Specified by:
removeAllListenersin interfaceRPatternTopic
-
removeListener
public void removeListener(PatternMessageListener<?> listener)
Description copied from interface:RPatternTopicRemoves the listener by its instance- Specified by:
removeListenerin interfaceRPatternTopic- Parameters:
listener- - listener instance
-
getPatternNames
public List<String> getPatternNames()
Description copied from interface:RPatternTopicGet topic channel patterns- Specified by:
getPatternNamesin interfaceRPatternTopic- Returns:
- list of topic names
-
-