Package org.redisson.api
Interface RTopicRx
-
public interface RTopicRx
RxJava2 interface for Publish Subscribe object. Messages are delivered to all message listeners across Redis cluster.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <M> io.reactivex.rxjava3.core.Single<Integer>
addListener(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.io.reactivex.rxjava3.core.Single<Integer>
addListener(StatusListener listener)
Subscribes to status changes of this topicio.reactivex.rxjava3.core.Single<Long>
countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances.List<String>
getChannelNames()
Get topic channel names<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 asynchronouslyio.reactivex.rxjava3.core.Completable
removeListener(Integer... listenerIds)
Removes the listener byid
for listening this topicio.reactivex.rxjava3.core.Completable
removeListener(MessageListener<?> listener)
Removes the listener byinstance
for listening this topic
-
-
-
Method Detail
-
publish
io.reactivex.rxjava3.core.Single<Long> publish(Object message)
Publish the message to all subscribers of this topic asynchronously- Parameters:
message
- to send- Returns:
- the
Future
object with number of clients that received the message
-
addListener
io.reactivex.rxjava3.core.Single<Integer> addListener(StatusListener listener)
Subscribes to status changes of this topic- Parameters:
listener
- for messages- Returns:
- listener id
- See Also:
StatusListener
-
addListener
<M> io.reactivex.rxjava3.core.Single<Integer> addListener(Class<M> type, MessageListener<M> listener)
Subscribes to this topic.MessageListener.onMessage
is called when any message is published on this topic.- Type Parameters:
M
- - type of message- Parameters:
type
- - type of messagelistener
- for messages- Returns:
- locally unique listener id
- See Also:
MessageListener
-
removeListener
io.reactivex.rxjava3.core.Completable removeListener(Integer... listenerIds)
Removes the listener byid
for listening this topic- Parameters:
listenerIds
- - message listener ids- Returns:
- void
-
removeListener
io.reactivex.rxjava3.core.Completable removeListener(MessageListener<?> listener)
Removes the listener byinstance
for listening this topic- Parameters:
listener
- - message listener- Returns:
- void
-
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
-
countSubscribers
io.reactivex.rxjava3.core.Single<Long> countSubscribers()
Returns amount of subscribers to this topic across all Redisson instances. Each subscriber may have multiple listeners.- Returns:
- amount of subscribers
-
-