Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.84 KB

File metadata and controls

44 lines (33 loc) · 1.84 KB

Java-Reactive-Programming

Simple Java reactive programming exercises

Standart Java

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:

  • main thread on line 12
  • parallel-1 thread for reactive operations on line 12 Screenshot_3

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 Screenshot_4

Spring Boot

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!

See the image below. Screenshot_7

Starter video

Really well-prepared starter video https://www.youtube.com/watch?v=A5nCPqPH3Fc

Get Your Hands Dirty

Watch a more detailed starter video with practicing https://www.youtube.com/playlist?list=PLqq-6Pq4lTTYPR2oH7kgElMYZhJd4vOGI

More References