GH-1891 Updated the doc by adding a note on Consumer

This commit is contained in:
Oleg Zhurakousky
2020-01-24 13:21:48 +01:00
parent 358dc106ca
commit 92379f60c7

View File

@@ -577,6 +577,23 @@ the framework will split the returning sending out each item as an individual me
he desired behavior you can set it to `false` at which point such supplier will simply return
the produced Flux without splitting it.
===== Consumer (Reactive)
Reactive `Consumer` is a little bit special because it has a void return type, leaving framework with no reference to subscribe to.
Most likely you will not need to write `Consumer<Flux<?>>`, and instead write it as a `Function<Flux<?>, Mono<Void>>` invoking `then`
operator as the last operator on your stream.
For example:
[source,java]
----
public Function<Flux<?>, Mono<Void>>`consumer() {
return flux -> flux.map(..).filter(..).then();
}
----
But if you do need to write an explicit `Consumer<Flux<?>>`, remember to subscribe to the incoming Flux.
====== Polling Configuration Properties