Skip to content

Commit 4c8941d

Browse files
committed
Refine ReactiveRedisOperations#listenTo and listenTo…Later Javadoc mentioning resource usage.
Closes #2229
1 parent 2fe4c5b commit 4c8941d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java

+33
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,16 @@ public interface ReactiveRedisOperations<K, V> {
103103

104104
/**
105105
* Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those.
106+
* <p>
107+
* Note that this method allocates a new
108+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
109+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
110+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
106111
*
107112
* @param channels must not be {@literal null}.
108113
* @return a hot sequence of {@link Message messages}.
109114
* @since 2.1
115+
* @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
110116
*/
111117
default Flux<? extends Message<String, V>> listenToChannel(String... channels) {
112118

@@ -118,10 +124,16 @@ default Flux<? extends Message<String, V>> listenToChannel(String... channels) {
118124
/**
119125
* Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for
120126
* those.
127+
* <p>
128+
* Note that this method allocates a new
129+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
130+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
131+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
121132
*
122133
* @param patterns must not be {@literal null}.
123134
* @return a hot sequence of {@link Message messages}.
124135
* @since 2.1
136+
* @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
125137
*/
126138
default Flux<? extends Message<String, V>> listenToPattern(String... patterns) {
127139

@@ -132,16 +144,27 @@ default Flux<? extends Message<String, V>> listenToPattern(String... patterns) {
132144
/**
133145
* Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for
134146
* those.
147+
* <p>
148+
* Note that this method allocates a new
149+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
150+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
151+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
135152
*
136153
* @param topics must not be {@literal null}.
137154
* @return a hot sequence of {@link Message messages}.
138155
* @since 2.1
156+
* @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
139157
*/
140158
Flux<? extends Message<String, V>> listenTo(Topic... topics);
141159

142160
/**
143161
* Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. The
144162
* {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
163+
* <p>
164+
* Note that this method allocates a new
165+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
166+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
167+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
145168
*
146169
* @param channels must not be {@literal null}.
147170
* @return a hot sequence of {@link Message messages}.
@@ -158,6 +181,11 @@ default Mono<Flux<? extends Message<String, V>>> listenToChannelLater(String...
158181
/**
159182
* Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for
160183
* those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
184+
* <p>
185+
* Note that this method allocates a new
186+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
187+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
188+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
161189
*
162190
* @param patterns must not be {@literal null}.
163191
* @return a hot sequence of {@link Message messages}.
@@ -173,6 +201,11 @@ default Mono<Flux<? extends Message<String, V>>> listenToPatternLater(String...
173201
/**
174202
* Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for
175203
* those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
204+
* <p>
205+
* Note that this method allocates a new
206+
* {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
207+
* connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
208+
* you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
176209
*
177210
* @param topics must not be {@literal null}.
178211
* @return a hot sequence of {@link Message messages}.

0 commit comments

Comments
 (0)