Interface ReactiveSubscription
public interface ReactiveSubscription
Subscription for Redis channels using reactive infrastructure. A 
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.
- Since:
- 2.1
- Author:
- Mark Paluch, Christoph Strobl
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classValue object for a Redis channel message.static interfaceReactiveSubscription.Messagerepresents a Redis channel message within Redis pub/sub.static classValue object for a Redis channel message received from a pattern subscription.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>cancel()Returns the (named) channels for this subscription.Returns the channel patters for this subscription.reactor.core.publisher.Mono<Void>pSubscribe(ByteBuffer... patterns) Subscribes to the channelpatternsand adds these to the current subscription.reactor.core.publisher.Mono<Void>Cancels the subscription for all channels matched bygetPatterns()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 emittingmessages.reactor.core.publisher.Mono<Void>subscribe(ByteBuffer... channels) Subscribes to thechannelsand adds these to the current subscription.reactor.core.publisher.Mono<Void>Cancels the current subscription for allchannels.reactor.core.publisher.Mono<Void>unsubscribe(ByteBuffer... channels) Cancels the current subscription for all given channels.
- 
Method Details- 
subscribeSubscribes to thechannelsand adds these to the current subscription.- Parameters:
- channels- channel names. Must not be empty.
- Returns:
- empty Monothat completes once the channel subscription is registered.
 
- 
pSubscribeSubscribes to the channelpatternsand adds these to the current subscription.- Parameters:
- patterns- channel patterns. Must not be empty.
- Returns:
- empty Monothat completes once the pattern subscription is registered.
 
- 
unsubscribereactor.core.publisher.Mono<Void> unsubscribe()Cancels the current subscription for allchannels.- Returns:
- empty Monothat completes once the channel subscriptions are unregistered.
 
- 
unsubscribeCancels the current subscription for all given channels.- Parameters:
- channels- channel names. Must not be empty.
- Returns:
- empty Monothat completes once the channel subscriptions are unregistered.
 
- 
pUnsubscribereactor.core.publisher.Mono<Void> pUnsubscribe()Cancels the subscription for all channels matched bygetPatterns()patterns}.- Returns:
- empty Monothat completes once the patterns subscriptions are unregistered.
 
- 
pUnsubscribeCancels the subscription for all channels matching the given patterns.- Parameters:
- patterns- must not be empty.
- Returns:
- empty Monothat completes once the patterns subscriptions are unregistered.
 
- 
getChannelsSet<ByteBuffer> getChannels()Returns the (named) channels for this subscription.- Returns:
- Setof named channels.
 
- 
getPatternsSet<ByteBuffer> getPatterns()Returns the channel patters for this subscription.- Returns:
- Setof channel patterns.
 
- 
receivereactor.core.publisher.Flux<ReactiveSubscription.Message<ByteBuffer,ByteBuffer>> receive()Retrieve the message stream emittingmessages. The resulting message stream contains only messages for subscribed and registeredchannelsandpatterns.Stream publishing uses ConnectableFluxturning 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 thisSubscriptionisis terminated.- Returns:
- Fluxemitting the- ReactiveSubscription.Messagestream.
 
- 
cancelreactor.core.publisher.Mono<Void> cancel()Unsubscribe from allchannelsandpatternsand request termination of all activemessage streams. Active streams will terminate with aCancellationException.- Returns:
- a Monothat completes once termination is finished.
 
 
-