Skip to content

Commit f58d4e9

Browse files
mp911dechristophstrobl
authored andcommitted
Fix ReactiveRedisMessageListenerContainer disposal via ReactiveRedisTemplate.listenToLater(…).
We now properly dispose the container at the right time and not as result of the Mono<…> completion. Closes: #2386 Original Pull Request: #2467
1 parent c3b9e50 commit f58d4e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ public Mono<Flux<? extends Message<String, V>>> listenToLater(Topic... topics) {
291291

292292
return (Mono) container.receiveLater(Arrays.asList(topics), getSerializationContext().getStringSerializationPair(),
293293
getSerializationContext().getValueSerializationPair()) //
294-
.doFinally((signalType) -> container.destroyLater().subscribe());
294+
.map(it -> it.doFinally(signalType -> container.destroyLater().subscribe()))
295+
.doOnCancel(() -> container.destroyLater().subscribe());
295296
}
296297

297298
// -------------------------------------------------------------------------

0 commit comments

Comments
 (0)