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()
RTopic
getChannelNames
in interface RTopic
public long publish(Object message)
RTopic
protected String getName()
public RFuture<Long> publishAsync(Object message)
RTopicAsync
publishAsync
in interface RTopicAsync
message
- to sendpublic int addListener(StatusListener listener)
RTopic
addListener
in interface RTopic
listener
- for messagesStatusListener
public <M> int addListener(Class<M> type, MessageListener<? extends M> listener)
RTopic
MessageListener.onMessage
is called when any message
is published on this topic.addListener
in interface RTopic
M
- - type of messagetype
- - type of messagelistener
- for messagesMessageListener
public RFuture<Integer> addListenerAsync(StatusListener listener)
RTopicAsync
addListenerAsync
in interface RTopicAsync
listener
- for messagesStatusListener
public <M> RFuture<Integer> addListenerAsync(Class<M> type, MessageListener<M> listener)
RTopicAsync
MessageListener.onMessage
is called when any message
is published on this topic.addListenerAsync
in interface RTopicAsync
M
- type of messagetype
- - type of messagelistener
- for messagesMessageListener
protected RFuture<Integer> addListenerAsync(RedisPubSubListener<?> pubSubListener)
public void removeAllListeners()
RTopic
removeAllListeners
in interface RTopic
protected void acquire(AsyncSemaphore semaphore)
public void removeListener(MessageListener<?> listener)
RTopic
removeListener
in interface RTopic
listener
- - listener instancepublic RFuture<Void> removeListenerAsync(MessageListener<?> listener)
RTopicAsync
removeListenerAsync
in interface RTopicAsync
listener
- - listener instancepublic RFuture<Void> removeListenerAsync(Integer... listenerIds)
RTopicAsync
id
for listening this topicremoveListenerAsync
in interface RTopicAsync
listenerIds
- - listener idspublic void removeListener(Integer... listenerIds)
RTopic
id
for listening this topicremoveListener
in interface RTopic
listenerIds
- - listener idspublic int countListeners()
RTopic
countListeners
in interface RTopic
public RFuture<Long> countSubscribersAsync()
RTopicAsync
countSubscribersAsync
in interface RTopicAsync
public long countSubscribers()
RTopic
countSubscribers
in interface RTopic
Copyright © 2014–2021 Redisson. All rights reserved.