From a3a08919e0a8ce26491740e93a93800302f10e01 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Wed, 11 Dec 2019 13:44:32 +0100 Subject: [PATCH] GH-423 Ensure that SupplierExporter assumes generic Publisher Resolves #423 --- .../cloud/function/web/source/SupplierExporter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/source/SupplierExporter.java b/spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/source/SupplierExporter.java index a65aa35ed..09ff2d3ed 100644 --- a/spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/source/SupplierExporter.java +++ b/spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/source/SupplierExporter.java @@ -24,6 +24,7 @@ import java.util.function.Supplier; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.reactivestreams.Publisher; import reactor.core.Disposable; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -90,7 +91,7 @@ public class SupplierExporter implements SmartLifecycle { Set names = this.supplier == null ? this.catalog.getNames(Supplier.class) : Collections.singleton(this.supplier); for (String name : names) { - Supplier> supplier = this.catalog.lookup(Supplier.class, name); + Supplier> supplier = this.catalog.lookup(Supplier.class, name); if (supplier == null) { logger.warn("No such Supplier: " + name); continue; @@ -156,8 +157,8 @@ public class SupplierExporter implements SmartLifecycle { callback.run(); } - private Flux forward(Supplier> supplier, String name) { - return supplier.get().flatMap(value -> { + private Flux forward(Supplier> supplier, String name) { + return Flux.from(supplier.get()).flatMap(value -> { String destination = this.destinationResolver.destination(supplier, name, value); if (this.debug) {