I like to know what is really going on internally while we use a observer in RxJava, and how do the subscriber get all the data stream from the observer.
Thanking you all in advance.
I like to know what is really going on internally while we use a observer in RxJava, and how do the subscriber get all the data stream from the observer.
Thanking you all in advance.
You can think of RxJava as an extreme generalization of the Observer pattern. You essentially register a call-back with the thing you are observing (the observable). The observable item calls onNext()
whenever it has an item it wants to emit, then onComplete()
when it is done.
All of the rest of the RxJava implementation supports flow control, composition of call-backs, allowing multiple call-backs on an observable, time-distortions, combining different observables, and thread management.
If you really want to know the internals, you can read the code. More importantly, you can read the narratives of David Karnok, a principal architect and developer of RxJava and reactive streams. Here is a sample blog describing internals of connected observables.