
com.lambdaworks.redis.pubsub.api.reactive.RedisPubSubReactiveCommands Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce Show documentation
Show all versions of lettuce Show documentation
Advanced and thread-safe Java Redis client for synchronous, asynchronous, and
reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs
and much more.
The newest version!
/*
* Copyright 2011-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lambdaworks.redis.pubsub.api.reactive;
import com.lambdaworks.redis.api.reactive.RedisReactiveCommands;
import com.lambdaworks.redis.pubsub.RedisPubSubListener;
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.Mono;
/**
* Asynchronous and thread-safe Redis PubSub API.
*
* @param Key type.
* @param Value type.
* @author Mark Paluch
* @since 5.0
*/
public interface RedisPubSubReactiveCommands extends RedisReactiveCommands {
/**
* Add a new listener.
*
* @param listener Listener.
*/
void addListener(RedisPubSubListener listener);
/**
* Remove an existing listener.
*
* @param listener Listener.
*/
void removeListener(RedisPubSubListener listener);
/**
* Flux for messages ({@literal pmessage}) received though pattern subscriptions. The connection needs to be subscribed to
* one or more patterns using {@link #psubscribe(Object[])}.
*
* Warning! This method uses {@link reactor.core.publisher.FluxSink.OverflowStrategy#BUFFER} This does unbounded buffering
* and may lead to {@link OutOfMemoryError}. Use {@link #observePatterns(FluxSink.OverflowStrategy)} to specify a different
* strategy.
*
*
* @return hot Flux for subscriptions to {@literal pmessage}'s.
*/
Flux> observePatterns();
/**
* Flux for messages ({@literal pmessage}) received though pattern subscriptions. The connection needs to be subscribed to
* one or more patterns using {@link #psubscribe(Object[])}.
*
* @param overflowStrategy the overflow strategy to use.
* @return hot Flux for subscriptions to {@literal pmessage}'s.
*/
Flux> observePatterns(FluxSink.OverflowStrategy overflowStrategy);
/**
* Flux for messages ({@literal message}) received though channel subscriptions. The connection needs to be subscribed to
* one or more channels using {@link #subscribe(Object[])}.
*
*
* Warning! This method uses {@link reactor.core.publisher.FluxSink.OverflowStrategy#BUFFER} This does unbounded buffering
* and may lead to {@link OutOfMemoryError}. Use {@link #observeChannels(FluxSink.OverflowStrategy)} to specify a different
* strategy.
*
*
* @return hot Flux for subscriptions to {@literal message}'s.
*/
Flux> observeChannels();
/**
* Flux for messages ({@literal message}) received though channel subscriptions. The connection needs to be subscribed to
* one or more channels using {@link #subscribe(Object[])}.
*
* @param overflowStrategy the overflow strategy to use.
* @return hot Flux for subscriptions to {@literal message}'s.
*/
Flux> observeChannels(FluxSink.OverflowStrategy overflowStrategy);
/**
* Listen for messages published to channels matching the given patterns.
*
* @param patterns the patterns
* @return Flux<Success> Flux for {@code psubscribe} command
*/
Mono psubscribe(K... patterns);
/**
* Stop listening for messages posted to channels matching the given patterns.
*
* @param patterns the patterns
* @return Flux<Success> Flux for {@code punsubscribe} command
*/
Mono punsubscribe(K... patterns);
/**
* Listen for messages published to the given channels.
*
* @param channels the channels
* @return Flux<Success> Flux for {@code subscribe} command
*/
Mono subscribe(K... channels);
/**
* Stop listening for messages posted to the given channels.
*
* @param channels the channels
* @return Flux<Success> Flux for {@code unsubscribe} command.
*/
Mono unsubscribe(K... channels);
/**
* @return the underlying connection.
*/
StatefulRedisPubSubConnection getStatefulConnection();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy