Package org.redisson.api
Interface RReliableTopicAsync
-
- All Superinterfaces:
RExpirableAsync
,RObjectAsync
- All Known Subinterfaces:
RReliableTopic
- All Known Implementing Classes:
RedissonReliableTopic
public interface RReliableTopicAsync extends RExpirableAsync
Asynchronous interface for Reliable topic based on Redis Stream object.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.
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <M> RFuture<String>
addListenerAsync(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.RFuture<Integer>
countSubscribersAsync()
Returns amount of subscribers to this topic across all Redisson instances.RFuture<Long>
publishAsync(Object message)
Publish the message to all subscribers of this topic asynchronously.RFuture<Void>
removeAllListenersAsync()
Removes all listeners attached to this topic instanceRFuture<Void>
removeListenerAsync(String... listenerIds)
Removes the listener byid
attached to this topic instanceRFuture<Long>
sizeAsync()
Amount of messages stored in Redis Stream object.-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
sizeAsync
RFuture<Long> sizeAsync()
Amount of messages stored in Redis Stream object.- Returns:
- amount of messages
-
publishAsync
RFuture<Long> publishAsync(Object message)
Publish the message to all subscribers of this topic asynchronously. Each subscriber may have multiple listeners.- Parameters:
message
- to send- Returns:
- number of subscribers that received the message
-
addListenerAsync
<M> RFuture<String> addListenerAsync(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.MessageListener.onMessage
method is called when any message is published on this topic.Though messages broadcasted across all topic instances, listener is attached to this topic instance.
Watchdog is started when listener was registered.
- Type Parameters:
M
- - type of message- Parameters:
type
- - type of messagelistener
- for messages- Returns:
- id of listener attached to this topic instance
- See Also:
Config.setReliableTopicWatchdogTimeout(long)
,MessageListener
-
removeListenerAsync
RFuture<Void> removeListenerAsync(String... listenerIds)
Removes the listener byid
attached to this topic instance- Parameters:
listenerIds
- - listener ids- Returns:
- void
-
removeAllListenersAsync
RFuture<Void> removeAllListenersAsync()
Removes all listeners attached to this topic instance
-
-