English 中文(简体)
RxJava - How Observable works
  • 时间:2024-12-22

RxJava - How Observable works


Previous Page Next Page  

Observables represents the sources of data where as Observers (Subscribers) psten to them. In nutshell, an Observable emits items and a Subscriber then consumes these items.

Observable

    Observable provides data once subscriber starts pstening.

    Observable can emit any number of items.

    Observable can emit only signal of completion as well with no item.

    Observable can terminate successfully.

    Observable may never terminate. e.g. a button can be cpcked any number of times.

    Observable may throw error at any point of time.

Subscriber

    Observable can have multiple subscribers.

    When an Observable emits an item, each subscriber onNext() method gets invoked.

    When an Observable finished emitting items, each subscriber onComplete() method gets invoked.

    If an Observable emits error, each subscriber onError() method gets invoked.

Advertisements