Interface ReactivePubSubCommands
public interface ReactivePubSubCommands
Redis Pub/Sub commands executed using reactive infrastructure.
- Since:
- 2.1
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptiondefault reactor.core.publisher.Mono<ReactiveSubscription>
Creates a subscription for this connection.reactor.core.publisher.Mono<ReactiveSubscription>
createSubscription
(SubscriptionListener subscriptionListener) Creates a subscription for this connection.reactor.core.publisher.Mono<Void>
pSubscribe
(ByteBuffer... patterns) Subscribes the connection to all channels matching the givenpatterns
.default reactor.core.publisher.Mono<Long>
publish
(ByteBuffer channel, ByteBuffer message) Publishes the givenmessage
to the givenchannel
.reactor.core.publisher.Flux<Long>
publish
(org.reactivestreams.Publisher<ReactiveSubscription.ChannelMessage<ByteBuffer, ByteBuffer>> messageStream) Publishes the given messages to theappropriate channels
.reactor.core.publisher.Mono<Void>
subscribe
(ByteBuffer... channels) Subscribes the connection to the givenchannels
.
-
Method Details
-
createSubscription
Creates a subscription for this connection. Connections can have multipleReactiveSubscription
s.Use
createSubscription(SubscriptionListener)
to get notified when the subscription completes.- Returns:
- the subscription.
-
createSubscription
reactor.core.publisher.Mono<ReactiveSubscription> createSubscription(SubscriptionListener subscriptionListener) Creates a subscription for this connection. Connections can have multipleReactiveSubscription
s.- Parameters:
subscriptionListener
- the subscription listener to listen for subscription confirmations.- Returns:
- the subscription.
- Since:
- 2.6
-
publish
Publishes the givenmessage
to the givenchannel
.- Parameters:
channel
- the channel to publish to. Must not be null.message
- message to publish. Must not be null.- Returns:
- the number of clients that received the message.
- See Also:
-
publish
reactor.core.publisher.Flux<Long> publish(org.reactivestreams.Publisher<ReactiveSubscription.ChannelMessage<ByteBuffer, ByteBuffer>> messageStream) Publishes the given messages to theappropriate channels
.- Parameters:
messageStream
- the messages to publish to. Must not be null.- Returns:
- the number of clients that received the message.
- See Also:
-
subscribe
Subscribes the connection to the givenchannels
. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.Note that cancellation of the
Flux
will unsubscribe fromchannels
.- Parameters:
channels
- channel names, must not be null.- See Also:
-
pSubscribe
Subscribes the connection to all channels matching the givenpatterns
. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.Note that cancellation of the
Flux
will unsubscribe frompatterns
.- Parameters:
patterns
- channel name patterns, must not be null.- See Also:
-