Package org.redisson
Class RedissonPatternTopic
java.lang.Object
org.redisson.RedissonPatternTopic
- All Implemented Interfaces:
RPatternTopic
Distributed topic implementation. Messages are delivered to all message listeners across Redis cluster.
- Author:
- Nikita Koksharov
-
Constructor Summary
ModifierConstructorDescriptionprotected
RedissonPatternTopic
(Codec codec, CommandAsyncExecutor commandExecutor, String name) protected
RedissonPatternTopic
(CommandAsyncExecutor commandExecutor, String name) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 topicaddListenerAsync
(Class<T> type, PatternMessageListener<T> listener) addListenerAsync
(PatternStatusListener listener) Get topic channel patternsvoid
Removes all listeners from this topicRemoves all listeners from this topicvoid
removeListener
(int listenerId) Removes the listener byid
for listening this topicvoid
removeListener
(PatternMessageListener<?> listener) Removes the listener by its instanceremoveListenerAsync
(int listenerId)
-
Constructor Details
-
RedissonPatternTopic
-
RedissonPatternTopic
-
-
Method Details
-
addListener
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:
-
addListener
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:
-
addListenerAsync
- Specified by:
addListenerAsync
in interfaceRPatternTopic
-
addListenerAsync
- Specified by:
addListenerAsync
in interfaceRPatternTopic
-
acquire
-
removeListenerAsync
- 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
-
removeAllListenersAsync
Description copied from interface:RPatternTopic
Removes all listeners from this topic- Specified by:
removeAllListenersAsync
in interfaceRPatternTopic
- Returns:
- void
-
removeListener
Description copied from interface:RPatternTopic
Removes the listener by its instance- Specified by:
removeListener
in interfaceRPatternTopic
- Parameters:
listener
- - listener instance
-
getPatternNames
Description copied from interface:RPatternTopic
Get topic channel patterns- Specified by:
getPatternNames
in interfaceRPatternTopic
- Returns:
- list of topic names
-