public interface RReliableTopic extends RExpirable, RReliableTopicAsync
Dedicated Redis connection is allocated per instance (subscriber) of this object. Messages are delivered to all listeners attached to the same Redis setup.
Requires Redis 5.0.0 and higher.
Modifier and Type | Method and Description |
---|---|
<M> String |
addListener(Class<M> type,
MessageListener<M> listener)
Subscribes to this topic.
|
int |
countListeners()
Returns amount of registered listeners to this topic
|
int |
countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances.
|
long |
publish(Object message)
Publish the message to all subscribers of this topic asynchronously.
|
void |
removeAllListeners()
Removes all listeners from this topic
|
void |
removeListener(String... listenerIds)
Removes the listener by
id for listening this topic |
long |
size()
Amount of messages stored in Redis Stream object.
|
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addListenerAsync, countSubscribersAsync, publishAsync, removeAllListenersAsync, removeListenerAsync, sizeAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
long size()
long publish(Object message)
message
- to send<M> String addListener(Class<M> type, MessageListener<M> listener)
MessageListener.onMessage
method is called when any message
is published on this topic.
Watchdog is started when listener was registered.
M
- - type of messagetype
- - type of messagelistener
- for messagesConfig.setReliableTopicWatchdogTimeout(long)
,
MessageListener
void removeListener(String... listenerIds)
id
for listening this topiclistenerIds
- - listener idsvoid removeAllListeners()
int countListeners()
int countSubscribers()
Copyright © 2014–2021 Redisson. All rights reserved.