In order to have a deep understanding of Reactive Programming I was trying to reimplement, in a very simple way, the RxJava Observable class. This made me ask some important questions about reactive programming approach. I want to share them with you.
What I don't get is:
reactive programming makes use of callbacks, then the heavy and asynchronous operations are implemented by a worker thread (not the main thread) of our application. This worker thread waits for I/O operation, processing, etc. and when it finishes, then it calls back the caller through a callback method. The advantage can be that the main thread doesn't have to get blocked in order to wait for the response of a processing, because it's asynchronous and because it's called back when the process is finished.
My question is:
what is the advantage over simple multithreading? I mean, in multithreading there is no callback, so the worker thread doesn't call back the main thread, anyway it returns the result to the caller (using a Callable for example).
Both these two scenarios have one worker thread getting blocked in order to wait for I/O operations or processing.
The only difference is a callback over a return.
So what am I missing?