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 |
---|---|
int |
addListener(MessageListener<M> listener)
Subscribes to this topic.
|
int |
addListener(StatusListener listener)
Subscribes to status changes of 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()
RTopic
getChannelNames
in interface RTopic<M>
public long publish(M message)
RTopic
public RFuture<Long> publishAsync(M message)
RTopicAsync
publishAsync
in interface RTopicAsync<M>
message
- to sendRFuture
object with number of clients that received the messageprotected io.netty.buffer.ByteBuf encode(Object value)
public int addListener(StatusListener listener)
RTopic
addListener
in interface RTopic<M>
listener
- for messagesStatusListener
public int addListener(MessageListener<M> listener)
RTopic
MessageListener.onMessage
is called when any message
is published on this topic.addListener
in interface RTopic<M>
listener
- for messagesMessageListener
public RFuture<Integer> addListenerAsync(RedisPubSubListener<?> pubSubListener)
public void removeAllListeners()
RTopic
removeAllListeners
in interface RTopic<M>
public void removeListener(MessageListener<?> listener)
RTopic
removeListener
in interface RTopic<M>
listener
- - listener instancepublic void removeListener(int listenerId)
RTopic
id
for listening this topicremoveListener
in interface RTopic<M>
listenerId
- - listener idCopyright © 2014–2017 The Redisson Project. All rights reserved.