Simple Java reactive programming exercises
subscribe() method is the key method to trigger activation of reactive code.
See Exercise2.java file Program Counter on line 12 There are active two threads:
Program Counter on line 17 There are active three threads:
- main thread on line 17
- parallel-1 thread for reactive operations on line 12
- parallel-2 thread for reactive operations on line 15
WebFlux and Netty are used for the Reactive programming paradigm in Spring Boot.
See MyController.java Rest controller for the simple example.
hello() method return Mono<String> immediately for an HTTP request. WebFlux and Netty manage the response under the hood. So, the MyController class is non-blocking.
Try to delegate all functionality to operators to provide maximum utilization of the non-blocking approach. This is the key point!
Really well-prepared starter video https://www.youtube.com/watch?v=A5nCPqPH3Fc
Watch a more detailed starter video with practicing https://www.youtube.com/playlist?list=PLqq-6Pq4lTTYPR2oH7kgElMYZhJd4vOGI