Reactive programming builds a pipeline for data to flow through, rather than a list of instructions that must finish one after another. Each stage can work on data and pass it along. This can be useful when waiting for I/O would otherwise leave a thread blocked, but it is not the right fit for every task. section 11.1 section 11.2
Think of a newspaper subscription
A useful subscription delivers each issue when it is ready, while work on later issues continues. Waiting until an entire year’s issues are complete before delivering any resembles processing a whole batch before passing it to the next task. section 11.0
In Project Reactor, a Mono is a pipeline for at most one item; a Flux can carry zero, one, or many items. Both implement Reactive Streams’ Publisher. Operations such as map() transform data as it passes through a pipeline. Do not assume every operation runs on the same thread—or that it necessarily runs on a different one. section 11.2
String name = "Craig"; String capitalName = name.toUpperCase(); String greeting = "Hello, " + capitalName + "!"; System.out.println(greeting);
Follow the imperative greeting example: each statement completes before the next begins. section 11.2
Mono.just("Craig")
.map(n -> n.toUpperCase())
.map(cn -> "Hello, " + cn + "!")
.subscribe(System.out::println);
Compare the Reactor version: just() supplies a name, map() stages transform it, and subscribe() prints the greeting. section 11.2
Spring supports reactive programming through Spring WebFlux, a reactive web framework that borrows from Spring MVC. section 1.4.1





