Reactive Streams defines standard contracts for asynchronous stream processing with bounded resource usage. A publisher produces values, while a subscriber consumes them. Project Reactor implements these contracts and provides the functional API underlying Spring’s reactive programming model. section 17.1
The implementation model connects these roles:
- Publisher: the contract for a source of data. section 17.1
- Mono and Flux: Reactor publishers used to represent reactive data sources. section 17.1
- Subscriber: the consumer receiving values from a publisher. section 17.1
Reactive endpoint
A Spring WebFlux controller can return Mono<String> from an endpoint, producing a single reactive value with Mono.just("Hello!"). section 17.1
Figure 17.1 Non-reactive vs. reactive. In a non-reactive approach, the milk factory gets all the milk to be packaged in the morning and delivers all the boxes in the evening. In a reactive approach, as the milk is brought to the factory, it’s packaged and then delivered. For this scenario, a reactive approach is better as it allows milk to be collected throughout the day and delivered sooner to the clients.
Compare reactive processing with batch-style processing through the factory analogy: values are processed and delivered as they arrive rather than after the complete input is collected. section 17.1



