From 4c8941df6b3c8b5bfac3f93b761ee54aa5e1c213 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 16 Apr 2024 09:54:53 +0200 Subject: [PATCH] =?UTF-8?q?Refine=20`ReactiveRedisOperations#listenTo`=20a?= =?UTF-8?q?nd=20`listenTo=E2=80=A6Later`=20Javadoc=20mentioning=20resource?= =?UTF-8?q?=20usage.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2229 --- .../redis/core/ReactiveRedisOperations.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java index 88e06f0d5..c02d1eea8 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java @@ -103,10 +103,16 @@ public interface ReactiveRedisOperations { /** * Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param channels must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ default Flux> listenToChannel(String... channels) { @@ -118,10 +124,16 @@ public interface ReactiveRedisOperations { /** * Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for * those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param patterns must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ default Flux> listenToPattern(String... patterns) { @@ -132,16 +144,27 @@ public interface ReactiveRedisOperations { /** * Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for * those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param topics must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ Flux> listenTo(Topic... topics); /** * Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. The * {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param channels must not be {@literal null}. * @return a hot sequence of {@link Message messages}. @@ -158,6 +181,11 @@ public interface ReactiveRedisOperations { /** * Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for * those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param patterns must not be {@literal null}. * @return a hot sequence of {@link Message messages}. @@ -173,6 +201,11 @@ public interface ReactiveRedisOperations { /** * Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for * those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param topics must not be {@literal null}. * @return a hot sequence of {@link Message messages}.