title: How to use Realm asObservable with RxJava's concat() operator?
body: <p>I'm trying to use Realm with RxJava and Retrofit in a way DanLew described <a href="http://blog.danlew.net/2015/06/22/loading-data-from-multiple-sources-with-rxjava/" rel="noreferrer">here</a> concating input from realm and retrofit but it gets stuck if I adding realm into the chain</p>
  
  <pre><code>Observable.concat(countryStorage.restoreAsObservable(),
                networkService.api()
                    .getCountries()
                    .doOnNext(countryStorage::save))
                .first()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(//never reaching here)
  </code></pre>
  
  <p>storage</p>
  
  <pre><code> @Override public Observable&lt;List&lt;Country&gt;&gt; restoreAsObservable() {
          Realm realm = realmProvider.get();
          return realm.where(Country.class)
              .findAll()
              .asObservable()
              .map(countries -&gt; return realm.copyFromRealm(countries))
              .first(countries -&gt; return !countries.isEmpty())
              .doOnCompleted(realm::close());
        }
  </code></pre>
  
  <p>It seems that this could happen that observable is hot from Realm, but nothing about it in the docs and how I suppose to compose Realm with other observables?</p>
  
  <p><strong>UPDATE:</strong>
  It turns to be that it works fine in old way. The question still remain about new api.</p>
  
  <pre><code>return Observable.just(
          realm.copyFromRealm(realm.where(Country.class).findAll()))
          .filter(countries -&gt; !countries.isEmpty())
          .doOnCompleted(realm::close);
  </code></pre>