O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Offline flow Observable

Currently, in our main Observable flow, there is a big chunk of code that is responsible for the retrieval of financial stock updates and tweets in case there was an exception in the upstream:

.onExceptionResumeNext(v2(StorIOFactory.get(this)                .get()                .listOfObjects(StockUpdate.class)                .withQuery(Query.builder()                        .table(StockUpdateTable.TABLE)                        .orderBy("date DESC")                        .limit(50)                        .build())                .prepare()                .asRxObservable())                .take(1)                .flatMap(Observable::fromIterable))

As you remember, this is used to retrieve elements from the local database when there is no internet connectivity (or some other error occurred upstream).

This big piece of code is quite distracting and takes attention of the purpose it is supposed to complete in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required