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 protected
RedissonPatternTopic(Codec codec, CommandAsyncExecutor commandExecutor, String name)
protected
RedissonPatternTopic(CommandAsyncExecutor commandExecutor, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acquire(AsyncSemaphore semaphore)
<T> int
addListener(Class<T> type, PatternMessageListener<T> listener)
Subscribes to this topic.int
addListener(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 patternsvoid
removeAllListeners()
Removes all listeners from this topicvoid
removeListener(int listenerId)
Removes the listener byid
for listening this topicvoid
removeListener(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:RPatternTopic
Subscribes to status changes of this topic- Specified by:
addListener
in 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:RPatternTopic
Subscribes to this topic.MessageListener.onMessage
is called when any message is published on this topic.- Specified by:
addListener
in 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:
addListenerAsync
in interfaceRPatternTopic
-
addListenerAsync
public <T> RFuture<Integer> addListenerAsync(Class<T> type, PatternMessageListener<T> listener)
- Specified by:
addListenerAsync
in interfaceRPatternTopic
-
acquire
protected void acquire(AsyncSemaphore semaphore)
-
removeListenerAsync
public RFuture<Void> removeListenerAsync(int listenerId)
- Specified by:
removeListenerAsync
in interfaceRPatternTopic
-
removeListener
public void removeListener(int listenerId)
Description copied from interface:RPatternTopic
Removes the listener byid
for listening this topic- Specified by:
removeListener
in interfaceRPatternTopic
- Parameters:
listenerId
- - id of message listener
-
removeAllListeners
public void removeAllListeners()
Description copied from interface:RPatternTopic
Removes all listeners from this topic- Specified by:
removeAllListeners
in interfaceRPatternTopic
-
removeListener
public void removeListener(PatternMessageListener<?> listener)
Description copied from interface:RPatternTopic
Removes the listener by its instance- Specified by:
removeListener
in interfaceRPatternTopic
- Parameters:
listener
- - listener instance
-
getPatternNames
public List<String> getPatternNames()
Description copied from interface:RPatternTopic
Get topic channel patterns- Specified by:
getPatternNames
in interfaceRPatternTopic
- Returns:
- list of topic names
-
-