public class RedissonTopic extends Object implements RTopic
Constructor and Description |
---|
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.
|
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.
|
protected io.netty.buffer.ByteBuf |
encode(Object value) |
List<String> |
getChannelNames()
Get topic channel names
|
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(int listenerId)
Removes the listener by
id for listening this topic |
void |
removeListener(MessageListener<?> listener)
Removes the listener by its instance
|
RFuture<Void> |
removeListenerAsync(int listenerId)
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 List<String> getChannelNames()
RTopic
getChannelNames
in interface RTopic
public long publish(Object message)
RTopic
public RFuture<Long> publishAsync(Object message)
RTopicAsync
publishAsync
in interface RTopicAsync
message
- to sendprotected io.netty.buffer.ByteBuf encode(Object value)
public 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
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(int listenerId)
RTopicAsync
id
for listening this topicremoveListenerAsync
in interface RTopicAsync
listenerId
- - listener idpublic void removeListener(int listenerId)
RTopic
id
for listening this topicremoveListener
in interface RTopic
listenerId
- - listener idpublic 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–2018 The Redisson Project. All rights reserved.