GH-243, GH-257 Added reactive consumer wrapper

- Added wrapper for an already reactive consumer to ensure that consumers can be consistently represented as Function<Flux, Mono>
- Fixed the big that deal with inconsistent result in web environments due to inconsistent representation of the Consumers
- Polished tests

Resolves #243
Resolves #257
This commit is contained in:
Oleg Zhurakousky
2019-02-11 15:30:04 +01:00
parent 660aebc4d9
commit 805b85b102
10 changed files with 175 additions and 69 deletions

View File

@@ -560,10 +560,10 @@ public class ContextFunctionCatalogAutoConfigurationTests {
"spring.cloud.function.compile.foos.lambda=f -> f.subscribe("
+ getClass().getName() + "::set)",
"spring.cloud.function.compile.foos.type=consumer");
assertThat((Consumer<?>) this.catalog.lookup(Consumer.class, "foos"))
.isInstanceOf(Consumer.class);
assertThat((Function<?, ?>) this.catalog.lookup(Function.class, "foos"))
.isInstanceOf(Function.class);
assertThat(this.inspector
.getInputWrapper(this.catalog.lookup(Consumer.class, "foos")))
.getInputWrapper(this.catalog.lookup(Function.class, "foos")))
.isEqualTo(Flux.class);
@SuppressWarnings("unchecked")
Consumer<Flux<String>> consumer = (Consumer<Flux<String>>) this.context