Now, all the tools needed to load StockUpdate entries from the database for offline viewing are available.
To plug in the database reading functionality for offline use, we will use .onExceptionResumeNext() as we discussed previously; it will be used to catch the error when Internet connection fails and resume the loading of stream items from SQLite.
.onExceptionResumeNext() should be inserted just after this call because we don't want to save saved entries again:
.doOnNext(this::saveStockUpdate)
So, the newly inserted call will look like this in the existing flow:
.doOnNext(this::saveStockUpdate)
.onExceptionResumeNext(...)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(stockUpdate -> {