Package org.redisson.api
Interface RReliableTopicAsync
- All Superinterfaces:
RExpirableAsync
,RObjectAsync
- All Known Subinterfaces:
RReliableTopic
- All Known Implementing Classes:
RedissonReliableTopic
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
Modifier and TypeMethodDescriptionaddListenerAsync
(Class<M> type, MessageListener<M> listener) Subscribes to this topic.Returns amount of subscribers to this topic across all Redisson instances.publishAsync
(Object message) Publish the message to all subscribers of this topic asynchronously.Removes all listeners attached to this topic instanceremoveListenerAsync
(String... listenerIds) Removes the listener byid
attached to this topic instanceAmount of messages stored in Redis Stream object.Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
sizeAsync
Amount of messages stored in Redis Stream object.- Returns:
- amount of messages
-
publishAsync
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
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:
-
removeListenerAsync
Removes the listener byid
attached to this topic instance- Parameters:
listenerIds
- - listener ids- Returns:
- void
-
removeAllListenersAsync
Removes all listeners attached to this topic instance -
countSubscribersAsync
Returns amount of subscribers to this topic across all Redisson instances. Each subscriber may have multiple listeners.- Returns:
- amount of subscribers
-