public class RedissonTopic extends Object implements RTopic
| Constructor and Description |
|---|
RedissonTopic(Codec codec,
CommandAsyncExecutor commandExecutor,
NameMapper nameMapper,
String name) |
RedissonTopic(Codec codec,
CommandAsyncExecutor commandExecutor,
String name) |
RedissonTopic(CommandAsyncExecutor commandExecutor,
String name) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
acquire(AsyncSemaphore semaphore) |
<M> int |
addListener(Class<M> type,
MessageListener<? extends M> listener)
Subscribes to this topic.
|
int |
addListener(StatusListener listener)
Subscribes to status changes of this topic
|
<M> RFuture<Integer> |
addListenerAsync(Class<M> type,
MessageListener<M> listener)
Subscribes to this topic.
|
protected RFuture<Integer> |
addListenerAsync(RedisPubSubListener<?> pubSubListener) |
RFuture<Integer> |
addListenerAsync(StatusListener listener)
Subscribes to status changes of this topic
|
int |
countListeners()
Returns amount of registered listeners to this topic
|
long |
countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances.
|
RFuture<Long> |
countSubscribersAsync()
Returns amount of subscribers to this topic across all Redisson instances.
|
static RedissonTopic |
createRaw(Codec codec,
CommandAsyncExecutor commandExecutor,
String name) |
static RedissonTopic |
createRaw(CommandAsyncExecutor commandExecutor,
String name) |
List<String> |
getChannelNames()
Get topic channel names
|
protected String |
getName() |
protected String |
getName(Object o) |
long |
publish(Object message)
Publish the message to all subscribers of this topic
|
RFuture<Long> |
publishAsync(Object message)
Publish the message to all subscribers of this topic asynchronously
|
void |
removeAllListeners()
Removes all listeners from this topic
|
void |
removeListener(Integer... listenerIds)
Removes the listener by
id for listening this topic |
void |
removeListener(MessageListener<?> listener)
Removes the listener by its instance
|
RFuture<Void> |
removeListenerAsync(Integer... listenerIds)
Removes the listener by
id for listening this topic |
RFuture<Void> |
removeListenerAsync(MessageListener<?> listener)
Removes the listener by its instance
|
public RedissonTopic(CommandAsyncExecutor commandExecutor, String name)
public RedissonTopic(Codec codec, CommandAsyncExecutor commandExecutor, String name)
public RedissonTopic(Codec codec, CommandAsyncExecutor commandExecutor, NameMapper nameMapper, String name)
public static RedissonTopic createRaw(CommandAsyncExecutor commandExecutor, String name)
public static RedissonTopic createRaw(Codec codec, CommandAsyncExecutor commandExecutor, String name)
public List<String> getChannelNames()
RTopicgetChannelNames in interface RTopicpublic long publish(Object message)
RTopicprotected String getName()
public RFuture<Long> publishAsync(Object message)
RTopicAsyncpublishAsync in interface RTopicAsyncmessage - to sendpublic int addListener(StatusListener listener)
RTopicaddListener in interface RTopiclistener - for messagesStatusListenerpublic <M> int addListener(Class<M> type, MessageListener<? extends M> listener)
RTopicMessageListener.onMessage is called when any message
is published on this topic.addListener in interface RTopicM - - type of messagetype - - type of messagelistener - for messagesMessageListenerpublic RFuture<Integer> addListenerAsync(StatusListener listener)
RTopicAsyncaddListenerAsync in interface RTopicAsynclistener - for messagesStatusListenerpublic <M> RFuture<Integer> addListenerAsync(Class<M> type, MessageListener<M> listener)
RTopicAsyncMessageListener.onMessage is called when any message
is published on this topic.addListenerAsync in interface RTopicAsyncM - type of messagetype - - type of messagelistener - for messagesMessageListenerprotected RFuture<Integer> addListenerAsync(RedisPubSubListener<?> pubSubListener)
public void removeAllListeners()
RTopicremoveAllListeners in interface RTopicprotected void acquire(AsyncSemaphore semaphore)
public void removeListener(MessageListener<?> listener)
RTopicremoveListener in interface RTopiclistener - - listener instancepublic RFuture<Void> removeListenerAsync(MessageListener<?> listener)
RTopicAsyncremoveListenerAsync in interface RTopicAsynclistener - - listener instancepublic RFuture<Void> removeListenerAsync(Integer... listenerIds)
RTopicAsyncid for listening this topicremoveListenerAsync in interface RTopicAsynclistenerIds - - listener idspublic void removeListener(Integer... listenerIds)
RTopicid for listening this topicremoveListener in interface RTopiclistenerIds - - listener idspublic int countListeners()
RTopiccountListeners in interface RTopicpublic RFuture<Long> countSubscribersAsync()
RTopicAsynccountSubscribersAsync in interface RTopicAsyncpublic long countSubscribers()
RTopiccountSubscribers in interface RTopicCopyright © 2014–2021 Redisson. All rights reserved.