M - messagepublic class RedissonTopic<M> extends Object implements RTopic<M>
| 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) |
int |
addListener(MessageListener<M> listener)
Subscribes to this topic.
|
int |
addListener(StatusListener listener)
Subscribes to status changes of this topic
|
RFuture<Integer> |
addListenerAsync(MessageListener<M> listener)
Subscribes to this topic.
|
RFuture<Integer> |
addListenerAsync(RedisPubSubListener<?> pubSubListener) |
protected io.netty.buffer.ByteBuf |
encode(Object value) |
List<String> |
getChannelNames()
Get topic channel names
|
long |
publish(M message)
Publish the message to all subscribers of this topic
|
RFuture<Long> |
publishAsync(M 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
|
public RedissonTopic(CommandAsyncExecutor commandExecutor, String name)
public RedissonTopic(Codec codec, CommandAsyncExecutor commandExecutor, String name)
public List<String> getChannelNames()
RTopicgetChannelNames in interface RTopic<M>public long publish(M message)
RTopicpublic RFuture<Long> publishAsync(M message)
RTopicAsyncpublishAsync in interface RTopicAsync<M>message - to sendprotected io.netty.buffer.ByteBuf encode(Object value)
public int addListener(StatusListener listener)
RTopicaddListener in interface RTopic<M>listener - for messagesStatusListenerpublic int addListener(MessageListener<M> listener)
RTopicMessageListener.onMessage is called when any message
is published on this topic.addListener in interface RTopic<M>listener - for messagesMessageListenerpublic RFuture<Integer> addListenerAsync(MessageListener<M> listener)
RTopicAsyncMessageListener.onMessage is called when any message
is published on this topic.addListenerAsync in interface RTopicAsync<M>listener - for messagesMessageListenerpublic RFuture<Integer> addListenerAsync(RedisPubSubListener<?> pubSubListener)
public void removeAllListeners()
RTopicremoveAllListeners in interface RTopic<M>protected void acquire(AsyncSemaphore semaphore)
public void removeListener(MessageListener<?> listener)
RTopicremoveListener in interface RTopic<M>listener - - listener instancepublic void removeListener(int listenerId)
RTopicid for listening this topicremoveListener in interface RTopic<M>listenerId - - listener idCopyright © 2014–2018 The Redisson Project. All rights reserved.