Package org.redisson.api
Interface RTopicReactive
- All Known Subinterfaces:
RShardedTopicReactive
public interface RTopicReactive
Reactive interface for Publish Subscribe object. Messages are delivered to all message listeners across Redis cluster.
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescription<M> reactor.core.publisher.Mono
<Integer> addListener
(Class<M> type, MessageListener<M> listener) Subscribes to this topic.reactor.core.publisher.Mono
<Integer> addListener
(StatusListener listener) Subscribes to status changes of this topicreactor.core.publisher.Mono
<Long> Returns amount of subscribers to this topic across all Redisson instances.Get topic channel names<M> reactor.core.publisher.Flux
<M> getMessages
(Class<M> type) Returns continues stream of published messages.reactor.core.publisher.Mono
<Long> Publish the message to all subscribers of this topic asynchronouslyreactor.core.publisher.Mono
<Void> Removes all listeners from this topicreactor.core.publisher.Mono
<Void> removeListener
(Integer... listenerIds) Removes the listener byid
for listening this topicreactor.core.publisher.Mono
<Void> removeListener
(MessageListener<?> listener) Removes the listener byinstance
for listening this topic
-
Method Details
-
getChannelNames
Get topic channel names- Returns:
- channel names
-
publish
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
Subscribes to status changes of this topic- Parameters:
listener
- for messages- Returns:
- listener id
- See Also:
-
addListener
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:
-
removeListener
Removes the listener byid
for listening this topic- Parameters:
listenerIds
- - message listener ids- Returns:
- void
-
removeListener
Removes the listener byinstance
for listening this topic- Parameters:
listener
- - message listener- Returns:
- void
-
getMessages
Returns continues stream of published messages.- Type Parameters:
M
- type of message- Parameters:
type
- - type of message to listen- Returns:
- stream of messages
-
countSubscribers
reactor.core.publisher.Mono<Long> countSubscribers()Returns amount of subscribers to this topic across all Redisson instances. Each subscriber may have multiple listeners.- Returns:
- amount of subscribers
-
removeAllListeners
reactor.core.publisher.Mono<Void> removeAllListeners()Removes all listeners from this topic- Returns:
- void
-