0

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.

Nidin Lal
  • 1
  • 1
  • What do you mean? The `onXXX` methods are called on those observers immediately or over time depending on the business- and operator logic. – akarnokd Jul 12 '17 at 11:15
  • random tip, in Android Studio if you click on a class or method while pressing ctrl it will jump to the source – lelloman Jul 12 '17 at 11:36
  • The subscriber is the observer. It's the observable that produces the values. The observer consumes them. – Enigmativity Jul 12 '17 at 14:11

1 Answers1

0

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.

Bob Dalgleish
  • 8,167
  • 4
  • 32
  • 42