title: Using Realm with RxJava 2
body: <p>I am using RxJava 2 in my Android application, and am integrating Realm. As far as I can tell, Realm only supports RxJava 1 by default, and allows an <code>Observable</code> to be returned when querying for <code>RealmResults&lt;?&gt;</code>, like so:</p>
  
  <pre><code>Realm.getDefaultInstance()
      .where(VideoBundle.class)
      .findAll()
      .asObservable()
      .first()
  </code></pre>
  
  <p>The Observable returned is from RxJava 1. How can I use Realm and RxJava 2 together? I have come across 2 relevant issues, found <a href="https://github.com/realm/realm-java/issues/3497" rel="nofollow noreferrer">here</a> and <a href="https://github.com/realm/realm-java/issues/4135" rel="nofollow noreferrer">here</a>, but no succinct answer was found. Additionally, the documentation (found here: <a href="https://realm.io/docs/java/latest/#rxjava" rel="nofollow noreferrer">https://realm.io/docs/java/latest/#rxjava</a>) mentions creating a custom <code>RxObservableFactory</code>, but provides no resources on how to do so.</p>
  
  <p>How can Realm be used with a project already using RxJava 2?</p>