public interface ReactiveSubscription
ReactiveSubscription allows subscribing to
channels and patterns. It provides access to the
ReactiveSubscription.ChannelMessage stream that emits only messages for channels and patterns registered in
this ReactiveSubscription.
A reactive Redis connection can have multiple subscriptions. If two or more subscriptions subscribe to the same
target (channel/pattern) and one unsubscribes, then the other one will no longer receive messages for the target due
to how Redis handled Pub/Sub subscription.| Modifier and Type | Interface and Description |
|---|---|
static class |
ReactiveSubscription.ChannelMessage<C,M>
Value object for a Redis channel message.
|
static interface |
ReactiveSubscription.Message<C,M>
Message represents a Redis channel message within Redis pub/sub. |
static class |
ReactiveSubscription.PatternMessage<P,C,M>
Value object for a Redis channel message received from a pattern subscription.
|
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Void> |
cancel()
|
Set<ByteBuffer> |
getChannels()
Returns the (named) channels for this subscription.
|
Set<ByteBuffer> |
getPatterns()
Returns the channel patters for this subscription.
|
reactor.core.publisher.Mono<Void> |
pSubscribe(ByteBuffer... patterns)
Subscribes to the channel
patterns and adds these to the current subscription. |
reactor.core.publisher.Mono<Void> |
pUnsubscribe()
Cancels the subscription for all channels matched by
getPatterns() patterns}. |
reactor.core.publisher.Mono<Void> |
pUnsubscribe(ByteBuffer... patterns)
Cancels the subscription for all channels matching the given patterns.
|
reactor.core.publisher.Flux<ReactiveSubscription.Message<ByteBuffer,ByteBuffer>> |
receive()
Retrieve the message stream emitting
messages. |
reactor.core.publisher.Mono<Void> |
subscribe(ByteBuffer... channels)
Subscribes to the
channels and adds these to the current subscription. |
reactor.core.publisher.Mono<Void> |
unsubscribe()
Cancels the current subscription for all
channels. |
reactor.core.publisher.Mono<Void> |
unsubscribe(ByteBuffer... channels)
Cancels the current subscription for all given channels.
|
reactor.core.publisher.Mono<Void> subscribe(ByteBuffer... channels)
channels and adds these to the current subscription.channels - channel names. Must not be empty.Mono that completes once the channel subscription is registered.reactor.core.publisher.Mono<Void> pSubscribe(ByteBuffer... patterns)
patterns and adds these to the current subscription.patterns - channel patterns. Must not be empty.Mono that completes once the pattern subscription is registered.reactor.core.publisher.Mono<Void> unsubscribe()
channels.Mono that completes once the channel subscriptions are unregistered.reactor.core.publisher.Mono<Void> unsubscribe(ByteBuffer... channels)
channels - channel names. Must not be empty.Mono that completes once the channel subscriptions are unregistered.reactor.core.publisher.Mono<Void> pUnsubscribe()
getPatterns() patterns}.Mono that completes once the patterns subscriptions are unregistered.reactor.core.publisher.Mono<Void> pUnsubscribe(ByteBuffer... patterns)
patterns - must not be empty.Mono that completes once the patterns subscriptions are unregistered.Set<ByteBuffer> getChannels()
Set of named channels.Set<ByteBuffer> getPatterns()
Set of channel patterns.reactor.core.publisher.Flux<ReactiveSubscription.Message<ByteBuffer,ByteBuffer>> receive()
messages. The resulting message stream contains only messages
for subscribed and registered channels and patterns.
Stream publishing uses ConnectableFlux turning the stream into a hot sequence.
Emission is paused if there is no demand. Messages received in that time are buffered. This stream terminates
either if all subscribers unsubscribe or if this Subscription is is terminated.Flux emitting the ReactiveSubscription.Message stream.reactor.core.publisher.Mono<Void> cancel()
channels and patterns and request termination of
all active message streams. Active streams will terminate with a
CancellationException.Mono that completes once termination is finished.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.