Package org.redisson.api
Interface RReliableTopicRx
-
- All Superinterfaces:
RExpirableRx
,RObjectRx
public interface RReliableTopicRx extends RExpirableRx
RxJava2 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> io.reactivex.rxjava3.core.Single<String>
addListener(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.io.reactivex.rxjava3.core.Single<Integer>
countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances.<M> io.reactivex.rxjava3.core.Flowable<M>
getMessages(Class<M> type)
Returns continues stream of published messages.io.reactivex.rxjava3.core.Single<Long>
publish(Object message)
Publish the message to all subscribers of this topic asynchronously.io.reactivex.rxjava3.core.Completable
removeAllListeners()
Removes all listeners from this topicio.reactivex.rxjava3.core.Completable
removeListener(String... listenerIds)
Removes the listener byid
for listening this topicio.reactivex.rxjava3.core.Single<Long>
size()
Amount of messages stored in Redis Stream object.-
Methods inherited from interface org.redisson.api.RExpirableRx
clearExpire, expire, expireAt, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RObjectRx
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
-
-
-
Method Detail
-
size
io.reactivex.rxjava3.core.Single<Long> size()
Amount of messages stored in Redis Stream object.- Returns:
- amount of messages
-
publish
io.reactivex.rxjava3.core.Single<Long> publish(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
-
addListener
<M> io.reactivex.rxjava3.core.Single<String> addListener(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.MessageListener.onMessage
method is called when any message is published on this topic.Watchdog is started when listener was registered.
- Type Parameters:
M
- - type of message- Parameters:
type
- - type of messagelistener
- for messages- Returns:
- locally unique listener id
- See Also:
Config.setReliableTopicWatchdogTimeout(long)
,MessageListener
-
removeListener
io.reactivex.rxjava3.core.Completable removeListener(String... listenerIds)
Removes the listener byid
for listening this topic- Parameters:
listenerIds
- - listener ids- Returns:
- void
-
removeAllListeners
io.reactivex.rxjava3.core.Completable removeAllListeners()
Removes all listeners from this topic
-
countSubscribers
io.reactivex.rxjava3.core.Single<Integer> countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances. Each subscriber may have multiple listeners.- Returns:
- amount of subscribers
-
getMessages
<M> io.reactivex.rxjava3.core.Flowable<M> getMessages(Class<M> type)
Returns continues stream of published messages.- Type Parameters:
M
- - type of message- Parameters:
type
- - type of message to listen- Returns:
- stream of messages
-
-