Skip to Content
Hands-On Reactive Programming in Spring 5
book

Hands-On Reactive Programming in Spring 5

by Oleh Dokuka, Igor Lozynskyi
October 2018
Intermediate to advanced
556 pages
15h 18m
English
Packt Publishing
Content preview from Hands-On Reactive Programming in Spring 5

The parallel operator

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Spring Microservices in Action, Second Edition

Spring Microservices in Action, Second Edition

John Carnell, Illary Huaylupo Sanchez

Publisher Resources

ISBN: 9781787284951Supplemental Content