{"id":6824,"date":"2017-06-19T18:53:34","date_gmt":"2017-06-19T15:53:34","guid":{"rendered":"http:\/\/www.fandroid.info\/?page_id=6824"},"modified":"2017-06-29T14:20:51","modified_gmt":"2017-06-29T11:20:51","slug":"lektsiya-3-po-arhitekture-android-prilozhenij-chast-2-rxjava-v-android","status":"publish","type":"page","link":"https:\/\/www.fandroid.info\/lektsiya-3-po-arhitekture-android-prilozhenij-chast-2-rxjava-v-android\/","title":{"rendered":"[:ru]\u041b\u0435\u043a\u0446\u0438\u044f 3 \u043f\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0427\u0430\u0441\u0442\u044c 2. RxJava \u0432 Android [:en]Lecture 3 on the architecture of android applications. Part 2. RxJava on Android[:]"},"content":{"rendered":"

[:ru]\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u041b\u0435\u043a\u0446\u0438\u0438 3<\/a> \u041a\u0443\u0440\u0441\u0430 \u043f\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0445 \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n

\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/p>\n

RxJava<\/a><\/p>\n

    \n
  1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 RxJava<\/a><\/li>\n
  2. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Observable<\/a><\/li>\n
  3. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/a><\/li>\n
  4. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/li>\n<\/ol>\n

    RxJava \u0432 Android<\/a><\/p>\n

    \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2013 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 Backpressure<\/a><\/p>\n

      \n
    1. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/a><\/li>\n
    2. \u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Observable.create<\/a><\/li>\n<\/ol>\n

      \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f<\/a>[wpanchor id=»1″]<\/p>\n

      \u0421\u0441\u044b\u043b\u043a\u0438 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/a><\/p>\n

      RxJava \u0432 Android<\/strong><\/h2>\n

      \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 RxJava \u2013 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f Java, \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 Android. \u041c\u044b \u0443\u0436\u0435 \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e RxJava \u2013 \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u0438 \u044d\u0442\u043e \u0432\u0441\u0435, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043e\u0434 Android.<\/p>\n

      \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 RxJava \u0432 Android \u2013 \u044d\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 RxJava \u0432 Retrofit<\/strong>. \u0414\u0430, \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u043e \u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 Observable, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n

      \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RxJava \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Retrofit. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e! \u041d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b Observable<\/strong>:<\/p>\n

      public interface MovieService {\r\n\r\n\r\n\r\n@GET(\"popular\/\")\r\n\r\nObservable<MoviesResponse> popularMovies();\r\n\r\n}\r\n\r\n\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0434\u043b\u044f Retrofit \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:\r\n\r\n@NonNull\r\n\r\nprivate static MovieService createService() {\r\n\r\nreturn new Retrofit.Builder()\r\n\r\n.baseUrl(BuildConfig.API_ENDPOINT)\r\n\r\n.client(getClient())\r\n\r\n.addConverterFactory(GsonConverterFactory.create())\r\n\r\n.addCallAdapterFactory(RxJavaCallAdapterFactory.create())\r\n\r\n.build()\r\n\r\n.create(MovieService.class);\r\n\r\n}<\/pre>\n

      \u0418 \u044d\u0442\u043e \u0432\u0441\u0435! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n

      ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());\r\n\r\n\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0431\u0430\u0440\u0430 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0435\u0433\u043e \u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430:\r\n\r\nApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .doOnSubscribe(mLoadingView::showLoadingIndicator)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .doAfterTerminate(mLoadingView::hideLoadingIndicator)\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());<\/pre>\n

      \u0427\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435? \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u2013 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c Observable<\/strong> \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n

      ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n.flatMap(movies -> {\r\n\r\nRealm.getDefaultInstance().executeTransaction(realm -> {\r\n\r\nrealm.delete(Movie.class);\r\n\r\nrealm.insert(movies);\r\n\r\n});\r\n\r\nreturn Observable.just(movies);\r\n\r\n})<\/pre>\n

      \u0415\u0441\u0442\u044c \u0438 \u0435\u0449\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c RxJava \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 onErrorResumeNext<\/strong>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445:<\/p>\n

      .onErrorResumeNext(throwable -> {\r\n\r\nRealm realm = Realm.getDefaultInstance();\r\n\r\nRealmResults<Movie> results = realm.where(Movie.class).findAll();\r\n\r\nreturn Observable.just(realm.copyFromRealm(results));\r\n\r\n})<\/pre>\n

      \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0443\u0436\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u043e\u0441\u043b\u0430, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u043f\u043e\u043a\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430, \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0441 RxJava \u0432\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043a\u043e\u0434 \u0434\u043b\u044f Observable \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b UI-\u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043f\u0440\u043e\u0449\u0435. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043b\u0435\u043a\u0446\u0438\u044f\u0445.<\/p>\n

      \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b\u043c \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 RxJava \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a Android. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2013 \u044d\u0442\u043e \u043d\u0430\u0448\u0430 \u043b\u044e\u0431\u0438\u043c\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c. RxJava \u2013 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f Java, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b Android. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u201c\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u201d \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442. \u041d\u043e \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n

      \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u043b\u0435\u043a\u0446\u0438\u0439: retain \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b, \u043b\u043e\u0430\u0434\u0435\u0440\u044b, \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0414\u0430, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0445 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0442\u0430\u043a \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043e\u0449\u044c RxJava.<\/p>\n

      \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0430\u043c\u043e\u0439 RxJava. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 subscribe<\/strong> \u0443 Observable<\/strong> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 Subscription<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u043d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0442\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0441 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n

      @Nullable\r\n\r\nprivate Subscription mMoviesSubscription;\r\n\r\n\/\/..\r\n\r\n\u00a0\r\n\r\nmMoviesSubscription = ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n\/\/...\r\n\r\n\r\n\r\n@Override\r\n\r\nprotected void onPause() {\r\n\r\nif (mMoviesSubscription != null) {\r\n\r\nmMoviesSubscription.unsubscribe();\r\n\r\n}\r\n\r\nsuper.onPause();\r\n\r\n}<\/pre>\n

      \u0422\u0430\u043a\u0436\u0435 \u0443 Observable<\/strong> \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 cache<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0441\u0442\u0430\u0440\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c Observable<\/strong> (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432 \u043b\u043e\u0430\u0434\u0435\u0440\u0435).<\/p>\n

      .doOnSubscribe(mLoadingView::showLoadingIndicator)\r\n\r\n.doAfterTerminate(mLoadingView::hideLoadingIndicator)\r\n\r\n.cache()\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());<\/pre>\n

      \u0418 \u0432-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 RxJava. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 RxLifecycle<\/a> \u043e\u0442 Trello. \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0438 \u044d\u0442\u043e \u043d\u0438\u0447\u0443\u0442\u044c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0447\u0435\u043c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n

      \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, RxJava \u0434\u043b\u044f \u043d\u0430\u0441 \u2013 \u044d\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043e\u043a. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Android \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 RxBindings<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 View \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435.[wpanchor id=»2″]<\/p>\n

      \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c RxJava \u0432 Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043c\u043d\u043e\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RxJava \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u043b\u0435\u043a\u0446\u0438\u0439.<\/p>\n

       <\/p>\n

      \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2013 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 Backpressure<\/strong><\/h2>\n

      \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b\u0438, RxJava \u2013 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043d\u043e \u0438\u043c \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u2013 \u044d\u0442\u043e \u043e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Observable.create()<\/strong>. \u041c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0435\u0435, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u043d\u0435 \u043e\u0442\u043f\u0438\u0441\u0430\u043b\u0441\u044f, \u0438\u043d\u0430\u0447\u0435 \u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n

      \u041d\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d\u043e \u043d\u0435\u043c\u0430\u043b\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e Observable<\/strong> \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u0438 \u043e\u043d\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c Backpressure<\/strong>.<\/p>\n

      \u0422\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u0430, \u0432\u0435\u0434\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0433\u0440\u0443\u0437\u044f\u0442\u0441\u044f \u0432 \u0444\u043e\u043d\u0435, \u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u043c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c UI.<\/p>\n

      \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 Backpressure<\/strong>:<\/p>\n

      Observable<String> observable = Observable.create(new Observable.OnSubscribe<String>() {\r\n\r\n@Override\r\n\r\npublic void call(Subscriber<? super String> subscriber) {\r\n\r\nfor (int i = 0; i < 1000; i++) {\r\n\r\nsubscriber.onNext(i + \"\");\r\n\r\n}\r\n\r\n}\r\n\r\n});\r\n\r\n\r\n\r\nobservable.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

      \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0438, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043e\u043d \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043a\u0440\u0430\u0448\u0443 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a onError<\/strong>). \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 System.out.println<\/strong> \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c [wpanchor id=»3″]\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 onNext<\/strong> \u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430. \u0418 \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Observable.create<\/strong>. \u0418 \u043d\u0435 \u0437\u0440\u044f \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u044f\u0442<\/a> \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043a\u0430\u043a deprecated<\/strong>. \u041d\u043e \u0440\u0430\u0437 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0435\u0441\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u0435.<\/p>\n

      1. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/strong><\/h3>\n

      \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0432\u0441\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 sample<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0435. \u0421\u0445\u0435\u043c\u0430 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n

      \"\"<\/span><\/p>\n

      \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 sample \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 10 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434:<\/p>\n

      createBackpressureObservable()\r\n\r\n.sample(10, TimeUnit.MICROSECONDS)\r\n\r\n.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

      \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0445):<\/p>\n

      233\r\n\r\n419\r\n\r\n536\r\n\r\n658\r\n\r\n797\r\n\r\n946<\/pre>\n

      \u0422\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0439 UI, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c sample<\/strong> \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443.<\/p>\n

      \u0415\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0438\u0437 \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 debounce<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u043e (\u0432\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c) \u043d\u0435\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0445\u0435\u043c\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 debounce<\/strong>:<\/p>\n

      \"\"<\/span><\/p>\n

      \u0421\u0430\u043c\u044b\u0439 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 debounce<\/strong> \u2013 \u0432\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442 \u0432\u0432\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 debounce<\/strong>.<\/p>\n

      \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0434\u0430\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u043b\u0438. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0443\u0434\u043e\u0431\u0435\u043d, \u043d\u043e \u043e\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c. \u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u043e\u0442\u0434\u0430\u0441\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0440\u0430\u0437\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 buffer<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043b\u0438\u0431\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u0441 \u044d\u0442\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0431\u0435\u0440\u0435\u0442\u0441\u044f). \u0421\u0445\u0435\u043c\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 buffer<\/strong>:<\/p>\n

      \"\"<\/span><\/p>\n

      \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n

      createBackpressureObservable()\r\n\r\n.buffer(100)\r\n\r\n.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

      [wpanchor id=»4″]\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0430 \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 \u043f\u043e 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u2013 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f MissingBackpressureException<\/strong> \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u044e.<\/p>\n

      2. \u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Observable.create<\/strong><\/h3>\n

      \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 Backpressure<\/strong> \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Observable<\/strong> \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 create. \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2013 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u0433\u0434\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 create<\/strong> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n

      \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043b\u0438 \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b just<\/strong>, from<\/strong> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n

      \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u044f\u0436\u0435\u043b\u044b\u0439 \u043a\u043e\u0434, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 fromCallable<\/strong>:<\/p>\n

      Observable.fromCallable(new Callable<List<Integer>>() {\r\n\r\n@Override\r\n\r\npublic List<Integer> call() throws Exception {\r\n\r\n\/\/some long-running operation\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return getUserIdsFromDatabase();\r\n\r\n}\r\n\r\n});<\/pre>\n

      \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 create<\/strong> \u2013 \u201c\u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u044c\u201d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432 Observable<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435. \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 create<\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n

      return Observable.create(new Observable.OnSubscribe<SensorEvent>() {\r\n\r\n@Override\r\n\r\npublic void call(final Subscriber<? super SensorEvent> subscriber) {\r\n\r\nSensorEventListener sensorEventListener = new SensorEventListener() {\r\n\r\n@Override\r\n\r\npublic void onSensorChanged(SensorEvent event) {\r\n\r\nif (subscriber != null && !subscriber.isUnsubscribed()) {\r\n\r\nsubscriber.onNext(event);\r\n\r\n}\r\n\r\n}\r\n\r\n\r\n\r\n@Override\r\n\r\npublic void onAccuracyChanged(Sensor sensor, int accuracy) {\r\n\r\n\/\/ do nothing\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n};\r\n\r\nsensorManager.registerListener(sensorEventListener, sensor, samplingPeriodUs);\r\n\r\nsubscriber.add(new MainThreadSubscription() {\r\n\r\n@Override\r\n\r\nprotected void onUnsubscribe() {\r\n\r\nsensorManager.unregisterListener(sensorEventListener);\r\n\r\n}\r\n\r\n});\r\n\r\n}\r\n\r\n});<\/pre>\n

      \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0438 \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f, \u0438 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u0435\u043d\u0441\u043e\u0440\u0430, \u0438 \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 Backpressure<\/strong> (\u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u043d\u0441\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u0439.<\/p>\n

      \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0435\u0437 create<\/strong> \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c, \u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0435\u0441\u0442\u044c, \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 fromEmitter<\/strong> \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n

      return Observable.fromEmitter(new Action1<AsyncEmitter<SensorEvent>>() {\r\n\r\n@Override\r\n\r\npublic void call(final AsyncEmitter<SensorEvent> sensorEventAsyncEmitter) {\r\n\r\nfinal SensorEventListener sensorListener = new SensorEventListener() {\r\n\r\n@Override\r\n\r\npublic void onSensorChanged(SensorEvent sensorEvent) {\r\n\r\nsensorEventAsyncEmitter.onNext(sensorEvent);\r\n\r\n}\r\n\r\n\r\n\r\n@Override\r\n\r\npublic void onAccuracyChanged(Sensor originSensor, int i) {\r\n\r\n\/\/ do nothing\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n};\r\n\r\n\r\n\r\nsensorEventAsyncEmitter.setCancellation(() -> sensorManager.unregisterListener(sensorListener, sensor));\r\n\r\nsensorManager.registerListener(sensorListener, sensor, samplingPeriodUs);\r\n\r\n}\r\n\r\n}, AsyncEmitter.BackpressureMode.LATEST);<\/pre>\n

      \u0412 \u0447\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c? \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 Backpressure<\/strong> \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 fromEmitter<\/strong>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438:<\/p>\n

      enum BackpressureMode {\r\n\r\nNONE,\r\n\r\nERROR,\r\n\r\nBUFFER,\r\n\r\nDROP,\r\n\r\nLATEST\r\n\r\n}<\/pre>\n

      \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 (\u0438 \u0434\u043e\u043b\u0436\u043d\u044b) \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 Observable.create<\/strong>![wpanchor id=»5″]<\/p>\n

      \u041f\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n

      \u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u00a0\u041f\u0440\u043e\u0435\u043a\u0442 RxJavaSamples<\/a><\/p>\n

      1)\u041f\u043e\u0442\u043e\u043a \u0441\u0442\u0440\u043e\u043a \u0432 \u043f\u043e\u0442\u043e\u043a \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u043c<\/p>\n

      2)\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n

      3)\u0421\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n

      4)\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n

      5)\u041f\u043e\u0442\u043e\u043a \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u0449\u0438\u0445 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/p>\n

      6)\u041f\u043e\u0442\u043e\u043a \u0441 \u0434\u043e\u043b\u0433\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c<\/p>\n

      \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435<\/h2>\n

      \u0421\u043a\u0430\u0447\u0430\u0442\u044c\u00a0\u041f\u0440\u043e\u0435\u043a\u0442 PopularMovies<\/a><\/p>\n

      1) \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 ru.gdgkazan.popularmovies.screen.details.MovieDetailsActivity<\/p>\n

      2)\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0439\u043b\u0435\u0440\u043e\u0432 \u0438 \u043e\u0442\u0437\u044b\u0432\u043e\u0432) \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e<\/p>\n

      3)\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445[wpanchor id=»6″]<\/p>\n

      4)\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/p>\n

      5)\u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Activity<\/p>\n

      \u0421\u0441\u044b\u043b\u043a\u0438 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/strong><\/h2>\n
        \n
      1. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/a>:\n
          \n
        1. RxJavaSamples \u2013 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0441 RxJava \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438.<\/li>\n
        2. PopularMovies \u2013 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RxJava \u0432 Android \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435.<\/li>\n
        3. BackpressureProblem \u2013 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 MissingBackpressureException \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/li>\n<\/ol>\n<\/li>\n
        4. \u0425\u043e\u0440\u043e\u0448\u0435\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/li>\n
        5. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043f\u043e Rx.<\/li>\n
        6. \u0412\u0438\u043a\u0438<\/a> \u043f\u043e RxJava.<\/li>\n
        7. \u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a<\/a> \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e Rx \u0438 RxJava.<\/li>\n
        8. \u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043f\u0440\u043e RxJava \u0438 RxAndroid \u0438 \u0438\u0445 \u043f\u0435\u0440\u0435\u0432\u043e\u0434<\/a> \u043d\u0430 \u0445\u0430\u0431\u0440\u0435.<\/li>\n
        9. \u0412\u0432\u043e\u0434\u043d\u044b\u0435 \u0432\u0438\u0434\u0435\u043e<\/a> \u043f\u0440\u043e RxJava.<\/li>\n
        10. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043f\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c \u0438\u0437 Rx.<\/li>\n
        11. \u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a<\/a> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0437 Rx.<\/li>\n
        12. \u0425\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 RxJava \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/li>\n
        13. \u0414\u043e\u043a\u043b\u0430\u0434<\/a> \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RxJava \u0432 \u042f\u043d\u0434\u0435\u043a\u0441.<\/li>\n
        14. \u041a\u043d\u0438\u0433\u0430<\/a> RxJava Essentials.<\/li>\n
        15. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043f\u0440\u043e Subjects.<\/li>\n
        16. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 Backpressure: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a>, \u0441\u043f\u043e\u0441\u043e\u0431\u044b<\/a> \u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u043d\u0435\u0439 \u0438 \u043e\u0442\u0432\u0435\u0442<\/a> \u043d\u0430 SO, \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043f\u0440\u043e fromEmitter.<\/li>\n<\/ol>\n

          \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435:<\/h2>\n

          \u041b\u0435\u043a\u0446\u0438\u044f 4 \u043f\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. Clean Arcitecture<\/a><\/h3>\n

          [:en]The second part Lectures 3<\/a> Course on the architecture of client-server android applications.<\/p>\n

          Introduction<\/a><\/p>\n

          RxJava<\/a><\/p>\n

            \n
          1. Introduction to RxJava<\/a><\/li>\n
          2. Creating an Observable<\/a><\/li>\n
          3. Basic Operators<\/a><\/li>\n
          4. Converting Data Streams<\/a><\/li>\n<\/ol>\n

            RxJava on Android<\/a><\/p>\n

            Additional — Backpressure problem<\/a><\/p>\n

              \n
            1. Using special operators<\/a><\/li>\n
            2. Abandon the use of Observable.create<\/a><\/li>\n<\/ol>\n

              Practical assignments<\/a>[wpanchor id=»1″]<\/p>\n

              Links and useful resources<\/a><\/p>\n

              RxJava on Android<\/h2>\n

              Since RxJava is a Java framework, there is nothing surprising in that it is fully supported in Android. We have already seen that RxJava is a powerful tool for managing asynchronous data flows, disassembled the main operators, and this, of course, can be applied in development for Android.<\/p>\n

              Probably the most important reason for RxJava’s widespread popularity in Android is the support for RxJava in Retrofit. Yes, the most popular library for network requests allows not only to return data from the server, but also wrap them in Observable, so that it is convenient to manage this data and work with asynchrony.<\/p>\n

              Let’s look at what you need to do to use RxJava for network queries with Retrofit. In fact, almost nothing! You need to change the service for network requests so that it returns Observable:<\/p>\n

              public interface MovieService {\r\n\r\n\r\n\r\n@GET(\"popular\/\")\r\n\r\nObservable<MoviesResponse> popularMovies();\r\n\r\n}\r\n\r\n\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0434\u043b\u044f Retrofit \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:\r\n\r\n@NonNull\r\n\r\nprivate static MovieService createService() {\r\n\r\nreturn new Retrofit.Builder()\r\n\r\n.baseUrl(BuildConfig.API_ENDPOINT)\r\n\r\n.client(getClient())\r\n\r\n.addConverterFactory(GsonConverterFactory.create())\r\n\r\n.addCallAdapterFactory(RxJavaCallAdapterFactory.create())\r\n\r\n.build()\r\n\r\n.create(MovieService.class);\r\n\r\n}<\/pre>\n

              And it’s all! Now we can asynchronously execute requests, process and receive data, and also handle errors:<\/p>\n

              ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());\r\n\r\n\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0431\u0430\u0440\u0430 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0435\u0433\u043e \u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430:\r\n\r\nApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .doOnSubscribe(mLoadingView::showLoadingIndicator)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .doAfterTerminate(mLoadingView::hideLoadingIndicator)\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());<\/pre>\n

              What can we add more? Of course, data caching. This is very easy to fix — we convert Observable so that it keeps a list of elements:<\/p>\n

              ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n.flatMap(movies -> {\r\n\r\nRealm.getDefaultInstance().executeTransaction(realm -> {\r\n\r\nrealm.delete(Movie.class);\r\n\r\nrealm.insert(movies);\r\n\r\n});\r\n\r\nreturn Observable.just(movies);\r\n\r\n})<\/pre>\n

              There is also the opportunity to improve the code using RxJava and show how to handle errors. Suppose we could not get data from the server, but we have cached data. Then in case of error, we can display them. This is done using the onErrorResumeNext method. This method, in the event of an error in the source data stream, changes it to another data stream that is transmitted in the parameter. In our case, this will be a data stream based on cached elements:<\/p>\n

              .onErrorResumeNext(throwable -> {\r\n\r\nRealm realm = Realm.getDefaultInstance();\r\n\r\nRealmResults<Movie> results = realm.where(Movie.class).findAll();\r\n\r\nreturn Observable.just(realm.copyFromRealm(results));\r\n\r\n})<\/pre>\n

              Of course, the complexity of the code has already grown significantly, but if we remember that while we implemented asynchronous query, showing progress, and caching, and error handling, we can not but admit that everything looks good with RxJava. In addition, usually the code for Observable is distributed so that UI classes do not work with caching, so everything becomes even easier. But about this in later lectures.<\/p>\n

              Of course, you need to be fair and say about the shortcomings that are in RxJava with reference to Android. The main drawback is our favorite problem with the life cycle. RxJava is a Java framework that does not know anything about Android problems. Therefore, decisions «out of the box» are not here. But there are many other possibilities.<\/p>\n

              First, of course, we can take advantage of the whole arsenal, which we had at the expense of past lectures: retain fragments, loaders, services. Yes, it can be inconvenient, but with the help of them we can both solve the problem of the life cycle, and preserve the power of RxJava.<\/p>\n

              Secondly, we can use the resources of RxJava itself. First of all, you can remember that the subscribe method of Observable returns a Subscription object that allows you to unsubscribe from the data stream. This does not fully solve the problem of processing the life cycle, but at least it allows us to unsubscribe from queries when exiting the screen:<\/p>\n

              @Nullable\r\n\r\nprivate Subscription mMoviesSubscription;\r\n\r\n\/\/..\r\n\r\n\u00a0\r\n\r\nmMoviesSubscription = ApiFactory.getMoviesService()\r\n\r\n.popularMovies()\r\n\r\n.map(MoviesResponse::getMovies)\r\n\r\n\/\/...\r\n\r\n\r\n\r\n@Override\r\n\r\nprotected void onPause() {\r\n\r\nif (mMoviesSubscription != null) {\r\n\r\nmMoviesSubscription.unsubscribe();\r\n\r\n}\r\n\r\nsuper.onPause();\r\n\r\n}<\/pre>\n

              Also, Observable has a cache method that allows you to execute the query only once. When you resubscribe, the old result will be returned. But you need to somehow save Observable (for example, in a loader).<\/p>\n

              .doOnSubscribe(mLoadingView::showLoadingIndicator)\r\n\r\n.doAfterTerminate(mLoadingView::hideLoadingIndicator)\r\n\r\n.cache()\r\n\r\n.subscribeOn(Schedulers.io())\r\n\r\n.observeOn(AndroidSchedulers.mainThread())\r\n\r\n.subscribe(this::showMovies, throwable -> showError());<\/pre>\n

              And thirdly, there are some libraries that are created to solve the life cycle problem when using RxJava. For example, this is a library\u00a0RxLifecycle<\/a><\/p>\n

              From Trello. That is, such problems can be solved, and this is not at all more difficult than using other means to perform queries.<\/p>\n

              Thus, RxJava for us is an extremely convenient tool for managing queries, multithreading and error handling. In addition, we must not forget that there are a large number of libraries that allow you to use various components of Android in a reactive style. Probably the most popular of these libraries is the library RxBindings<\/a>, which helps to work with View in a reactive style. [Wpanchor id = «2»]<\/p>\n

              Of course, it’s not necessary to use RxJava in Android development, but its use can greatly simplify the solutions of many tasks, so we will use RxJava throughout all future lectures.<\/p>\n

              Additional — Backpressure problem<\/h2>\n

              As we have already understood, RxJava is a very powerful tool, but at the same time it should be used very carefully. One such precaution is the failure to use Observable.create (). We have already seen that this does not make the code more obvious, but we also have to watch for the fact that the subscriber did not unsubscribe, otherwise he can not transmit data.<\/p>\n

              But there is a more serious problem, which is subject to a considerable number of applications. This problem is due to the fact that Observable can give data faster than the subscriber can process it, and it is known as Backpressure.<\/p>\n

              This situation is quite real, because the data is usually loaded in the background, and the subscriber is working in the main thread of the application, which can be blocked by some operation. In addition, the code for the operation of your subscriber may itself not be fast, for example, to redraw the UI.<\/p>\n

              Let’s give a minimal code that will allow us to reproduce the problem of Backpressure:<\/p>\n

              Observable<String> observable = Observable.create(new Observable.OnSubscribe<String>() {\r\n\r\n@Override\r\n\r\npublic void call(Subscriber<? super String> subscriber) {\r\n\r\nfor (int i = 0; i < 1000; i++) {\r\n\r\nsubscriber.onNext(i + \"\");\r\n\r\n}\r\n\r\n}\r\n\r\n});\r\n\r\n\r\n\r\nobservable.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

              It would seem that this is the most common code that you can find in any application, and, nevertheless, it leads to the crash (in this case, the onError handler). The problem is that the call to System.out.println is still noticeably slower than [wpanchor id = «3»] the usual onNext call on the subscriber. And you can face such a problem in any situation. The problem is initially the Observable.create method. And knowingly it is asked <\/a>to declare it as deprecated. But since there is such a problem, let’s look at two different ways how to protect ourselves from it.<\/p>\n

              1. Using special operators<\/strong><\/h3>\n

              First, there is a large group of operators that allow you to use only one element of all that came in a certain time \/ number of elements. For example, the sample operator allows you to get only the most recent element from all elements in the time period. The scheme of his work is as follows:<\/p>\n

              \"\"<\/span><\/p>\n

              For example, in the following example, the sample operator allows only one value to be used once every 10 microseconds:<\/p>\n

              createBackpressureObservable()\r\n\r\n.sample(10, TimeUnit.MICROSECONDS)\r\n\r\n.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

              As a result, we get about such a conclusion (which will differ on different starts):<\/p>\n

              233\r\n\r\n419\r\n\r\n536\r\n\r\n658\r\n\r\n797\r\n\r\n946<\/pre>\n

              This operator is convenient to use if, for example, your data is updated very often, but you only need the last value. You do not want to update your UI too often, so you can set the sample for a second, for example.<\/p>\n

              Another operator from such a group is the debounce operator, which gives data to the subscriber only if it is already long enough (waiting time is a parameter) that no new data is received. The debounce statement schema:<\/p>\n

              \"\"<\/span><\/p>\n

              The most typical example of using the debounce operator is user input. If you want to wait for the user to complete the data entry, before you execute the query, you should contact the debounce operator.<\/p>\n

              Previous operators always gave only one element from the group, with the remaining elements disappearing. This approach is convenient, but it is not always applicable. Sometimes we need to process all incoming data. The logical decision for such a case will be the use of some buffer that will accumulate data, and then give the data to the subscriber, which will process all the data in the list at once. To do this, there is a buffer operator that collects the data until it has elapsed enough time or until a sufficient element is found (with this possibility one needs to be extremely careful not to get into a situation where the required number of elements is never typed). Buffer operator’s scheme:<\/p>\n

              \"\"<\/span><\/p>\n

              You can apply it to solve the problem from our example:<\/p>\n

              createBackpressureObservable()\r\n\r\n.buffer(100)\r\n\r\n.observeOn(Schedulers.computation())\r\n\r\n.subscribe(System.out::println, throwable -> {\r\n\r\nSystem.out.println(\"error: \" + throwable);\r\n\r\n});<\/pre>\n

              [wpanchor id=»4″]Now we do not display every element, but in 100-element batches — the probability of getting MissingBackpressureException tends to zero.<\/p>\n

              2. Abandon the use of Observable.create<\/strong><\/h3>\n

              In fact, only the way to create Observable through the create method is affected by the Backpressure problem. The simplest solution is to refuse to use it. Now it’s possible. Consider several situations where you can replace the use of create with the help of other operators.<\/p>\n

              First, if you have several ready-made elements or their list, you can use the methods just, from and others.<\/p>\n

              Secondly, if you have some heavy code that returns one element, use fromCallable:<\/p>\n

              Observable.fromCallable(new Callable<List<Integer>>() {\r\n\r\n@Override\r\n\r\npublic List<Integer> call() throws Exception {\r\n\r\n\/\/some long-running operation\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return getUserIdsFromDatabase();\r\n\r\n}\r\n\r\n});<\/pre>\n

              And, finally, the most important reason for using the create method is to wrap some asynchronous call in the Observable so that it can be used in a reactive style. One example is the use of different sensors. The correct implementation of this approach using the create method is as follows:<\/p>\n

              return Observable.create(new Observable.OnSubscribe<SensorEvent>() {\r\n\r\n@Override\r\n\r\npublic void call(final Subscriber<? super SensorEvent> subscriber) {\r\n\r\nSensorEventListener sensorEventListener = new SensorEventListener() {\r\n\r\n@Override\r\n\r\npublic void onSensorChanged(SensorEvent event) {\r\n\r\nif (subscriber != null && !subscriber.isUnsubscribed()) {\r\n\r\nsubscriber.onNext(event);\r\n\r\n}\r\n\r\n}\r\n\r\n\r\n\r\n@Override\r\n\r\npublic void onAccuracyChanged(Sensor sensor, int accuracy) {\r\n\r\n\/\/ do nothing\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n};\r\n\r\nsensorManager.registerListener(sensorEventListener, sensor, samplingPeriodUs);\r\n\r\nsubscriber.add(new MainThreadSubscription() {\r\n\r\n@Override\r\n\r\nprotected void onUnsubscribe() {\r\n\r\nsensorManager.unregisterListener(sensorEventListener);\r\n\r\n}\r\n\r\n});\r\n\r\n}\r\n\r\n});<\/pre>\n

              Apparently, we have to deal with the problem that the subscriber can unsubscribe, and in order to correctly unsubscribe from the sensor events, and with the problem of Backpressure (since the sensors can be very sensitive and give data very often), which we considered earlier . In doing so, this is the only correct way, which contains many opportunities for errors and is also very long.<\/p>\n

              It seems that you can not do without create, but there is a way, it is implemented through the operation fromEmitter and looks like this:<\/p>\n

              return Observable.fromEmitter(new Action1<AsyncEmitter<SensorEvent>>() {\r\n\r\n@Override\r\n\r\npublic void call(final AsyncEmitter<SensorEvent> sensorEventAsyncEmitter) {\r\n\r\nfinal SensorEventListener sensorListener = new SensorEventListener() {\r\n\r\n@Override\r\n\r\npublic void onSensorChanged(SensorEvent sensorEvent) {\r\n\r\nsensorEventAsyncEmitter.onNext(sensorEvent);\r\n\r\n}\r\n\r\n\r\n\r\n@Override\r\n\r\npublic void onAccuracyChanged(Sensor originSensor, int i) {\r\n\r\n\/\/ do nothing\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n};\r\n\r\n\r\n\r\nsensorEventAsyncEmitter.setCancellation(() -> sensorManager.unregisterListener(sensorListener, sensor));\r\n\r\nsensorManager.registerListener(sensorListener, sensor, samplingPeriodUs);\r\n\r\n}\r\n\r\n}, AsyncEmitter.BackpressureMode.LATEST);<\/pre>\n

              What is the difference between this code and the previous one? First, it automatically requires to solve the problem of Backpressure due to the last parameter in the method fromEmitter. Possible values of this parameter cover all cases:<\/p>\n

              enum BackpressureMode {\r\n\r\nNONE,\r\n\r\nERROR,\r\n\r\nBUFFER,\r\n\r\nDROP,\r\n\r\nLATEST\r\n\r\n}<\/pre>\n

              So you can (and should) completely abandon the Observable.create method![wpanchor id=»5″]<\/p>\n

              Practical examples<\/h2>\n

              Download the project Project RxJavaSamples\u00a0<\/a><\/p>\n

              1) Stream of strings in a stream of numbers with a predicate<\/p>\n

              2) Obtaining unique data from the stream until condition<\/p>\n

              3) The sum of all the numbers in the data stream<\/p>\n

              4) Switching between data streams<\/p>\n

              5) Flow from the greatest common divisors for elements from input streams<\/p>\n

              6) Flow with a long calculation<\/p>\n

              Practical assignment<\/h2>\n

              Download Project PopularMovies<\/a><\/p>\n

              1) The condition of the problem in the class ru.gdgkazan.popularmovies.screen.details.MovieDetailsActivity<\/p>\n

              2) Carry out two requests (to receive trailers and reviews) in parallel<\/p>\n

              3) Display the process of loading data [wpanchor id = «6»]<\/p>\n

              4) Save the data to the database and use the cached data in case of an error<\/p>\n

              5) Process re-creation Activity<\/p>\n

              Links and useful resources<\/h2>\n
                \n
              1. \u00a0Applications from the repository<\/a>:\n
                  \n
                1. RxJavaSamples are examples of code with RxJava and practical tasks.<\/li>\n
                2. Popular Movies — an example of using RxJava in Android to perform network requests and a practical task.<\/li>\n
                3. BackpressureProblem — demonstration of examples of MissingBackpressureException and ways of the decision of this problem.<\/li>\n<\/ol>\n<\/li>\n
                4. A good introduction <\/a>to functional reactive programming.<\/li>\n
                5. Documentation <\/a>for Rx.<\/li>\n
                6. Wiki on<\/a>\u00a0RxJava.<\/li>\n
                7. A large list <\/a> of various articles on Rx and RxJava.<\/li>\n
                8. Introductory articles<\/a> about RxJava and RxAndroid and their translation on the Habr.<\/li>\n
                9. Introductory video <\/a>about RxJava.<\/li>\n
                10. Documentation <\/a>for operators from Rx.<\/li>\n
                11. Interactive list <\/a>of operators from Rx.<\/li>\n
                12. A good article <\/a>about using RxJava to load data from several sources.<\/li>\n
                13. Report <\/a>on the use of RxJava in Yandex.<\/li>\n
                14. The book <\/a>RxJava Essentials.<\/li>\n
                15. Documentation<\/a> about Subjects.<\/li>\n
                16. The problem of Backpressure: the description<\/a>, the ways <\/a>to combat it and the answer to SO, the article <\/a>about fromEmitter.<\/li>\n<\/ol>\n

                  \nContinuation:<\/h2>\n

                  Lecture 4 on the architecture of the android application. Clean Architecture<\/a><\/h3>\n

                  [:]<\/p>\n","protected":false},"excerpt":{"rendered":"

                  [:ru]\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u041b\u0435\u043a\u0446\u0438\u0438 3 \u041a\u0443\u0440\u0441\u0430 \u043f\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0445 \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 RxJava \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 RxJava \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Observable \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 RxJava \u0432 Android \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2013 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 Backpressure \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u041e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Observable.create \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f[wpanchor id=»1″] \u0421\u0441\u044b\u043b\u043a\u0438 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b RxJava \u0432 Android \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 RxJava \u2013 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f Java, \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e […]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":42,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/pages\/6824"}],"collection":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/comments?post=6824"}],"version-history":[{"count":10,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/pages\/6824\/revisions"}],"predecessor-version":[{"id":6923,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/pages\/6824\/revisions\/6923"}],"wp:attachment":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media?parent=6824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}