Posts

Showing posts from June, 2017

Reactive Glimpse Part - II

Reactive Concurrency Concurrency in Reactive universe has a little different flavour than what we experience in Imperative world. A Reactive flow by default Single Threaded in nature. But we can achieve concurrency with the help of the operators like subscribeOn(), observeOn() etc. along with the Schedulers that Rx provides. subscribeOn(): Asynchrously subscribes Subscribers/Observers to an ObservableSource on a Specified scheduler. onserveOn(): Makes an ObservableSource to send all notifications/events on a specified scheduler asynchronously. A few points that I would really like to state at the very beginning are: 1) The operators in a flow are always executed serially contextwise. 2) The Flow for a particular data item do not interfere with the flow for another data item belonging to the same ObservableSource. Let's try to understand the concurrency from the context of the below test case. @Test public void testConcurrency(){ rx.Observabl