Fix AbstractMProducingHandler for ReactiveAdapter

Turns out there is a reactive adapter for `CompletableFuture`
which is not an intention of the further logic
This commit is contained in:
Artem Bilan
2022-11-03 13:20:45 -04:00
parent 5f1c0c17de
commit 53d044814f

View File

@@ -310,11 +310,16 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
}
if (this.async) {
ReactiveAdapter reactiveAdapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(null, reply);
if (reply instanceof org.springframework.util.concurrent.ListenableFuture<?>
|| reply instanceof CompletableFuture<?>
|| reactiveAdapter != null) {
boolean isFutureReply =
reply instanceof org.springframework.util.concurrent.ListenableFuture<?> ||
reply instanceof CompletableFuture<?>;
ReactiveAdapter reactiveAdapter = null;
if (!isFutureReply) {
reactiveAdapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(null, reply);
}
if (isFutureReply || reactiveAdapter != null) {
if (replyChannel instanceof ReactiveStreamsSubscribableChannel reactiveStreamsSubscribableChannel) {
Publisher<?> reactiveReply = toPublisherReply(reply, reactiveAdapter);
reactiveStreamsSubscribableChannel