Understanding the Reactive Thread Model: Part 1

Reactive or non-blocking processing is in high demand, but before adopting it, one should deeply understand its thread model. For thread model two things are very important to know: thread communication and execution flow. In this blog, I will try to explain both of these topics in-depth.

What Is Reactive Programming?

There are lots of definitions on the web; the Wiki definition is a bit theoretical and generic. From a threading perspective, my version is "Reactive Programming is the processing of the asynchronous event stream, on which you can observe.”                                                                    

How Reactive Thread Works (Part 2)

In Part 1, we covered a reactive web and a simple blocking and non-blocking call. In this part, we will be covering, in-depth, the thread execution and business flow.

3) Non Blocking Call With Thread Execution

The diagram looks complex, but what we are doing is starting a new thread from the request thread and then calling the reactive function. Again, creating the new thread from the previous thread to do some console printing. What we want to test or achieve here is that both reactive sum() function and console printing happens in parallel. Execution of sum() is not blocking the start and print of the new thread.