October 2018
Intermediate to advanced
556 pages
15h 18m
English
Along with non-trivial operators for managing threads on which we want to process some part of the execution flow, Reactor offers a familiar technique for work paralleling. For that purpose, Reactor has an operator called .parallel, which allows the splitting of the flow on to the parallel substreams and the balancing of elements between them. The following is an example of this operator in use:
Flux.range(0, 10000) .parallel() .runOn(Schedulers.parallel()) .map() .filter() .subscribe()
As we can see from the preceding example, .parallel() is a part of the Flux API. One thing that we have noticed here is that, by applying the parallel operator, we start operating on a different type of Flux, which is called ParallelFlux ...