Project Reactor is a Java library that implements Reactive Streams and provides a functional API for composing asynchronous streams in Spring’s reactive programming model. section 17.1
Use its core types to model reactive web endpoints:
- Return Mono for a publisher that produces a single value, such as a HelloController endpoint returning Mono.just("Hello!"). section 17.1
- Use Flux alongside Mono when working with publishers of reactive data streams. section 17.1
Reactive endpoint
A Spring web endpoint can return Mono<String> and produce its response with Mono.just("Hello!"). The reactive web dependency enables Project Reactor classes and interfaces.
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, which collects and delivers work progressively, with non-reactive processing, which waits for the complete batch. section 17.1

