title: RxJava onErrorResumeNext()
body: <p>I have two observables (named A and B for simplicity) and one subscriber. So, the Subscriber subscribes to A and if there's an error on A then B (which is the fallback) kicks in. Now, whenever A hits an error B gets called fine, however A calls onComplete() on the subscriber, so B response never reaches the subscriber even if B execution is successful.</p>
  
  <p>Is this the normal behaviour? I thought onErrorResumeNext() should continue the stream and notify the subscriber once completed as noted in the documentation (<a href="https://github.com/ReactiveX/RxJava/wiki/Error-Handling-Operators#onerrorresumenext" rel="noreferrer">https://github.com/ReactiveX/RxJava/wiki/Error-Handling-Operators#onerrorresumenext</a>).</p>
  
  <p>This is the overall structure of what I'm doing (omitted several "boring" code):</p>
  
  <pre><code>public Observable&lt;ModelA&gt; observeGetAPI(){
      return retrofitAPI.getObservableAPI1()
              .flatMap(observableApi1Response -&gt; {
                  ModelA model = new ModelA();
  
                  model.setApi1Response(observableApi1Response);
  
                  return retrofitAPI.getObservableAPI2()
                          .map(observableApi2Response -&gt; {
                              // Blah blah blah...
                              return model;
                          })
                          .onErrorResumeNext(observeGetAPIFallback(model))
                          .subscribeOn(Schedulers.newThread())
              })
              .onErrorReturn(throwable -&gt; {
                  // Blah blah blah...
                  return model;
              })
              .subscribeOn(Schedulers.newThread());
  }
  
  private Observable&lt;ModelA&gt; observeGetAPIFallback(ModelA model){
      return retrofitAPI.getObservableAPI3().map(observableApi3Response -&gt; {
          // Blah blah blah...
          return model;
      }).onErrorReturn(throwable -&gt; {
          // Blah blah blah...
          return model;
      })
      .subscribeOn(Schedulers.immediate());
  }
  
  Subscription subscription;
  subscription = observeGetAPI.subscribe(ModelA -&gt; {
      // IF THERE'S AN ERROR WE NEVER GET B RESPONSE HERE...
  }, throwable -&gt;{
      // WE NEVER GET HERE... onErrorResumeNext()
  },
  () -&gt; { // IN CASE OF AN ERROR WE GET STRAIGHT HERE, MEANWHILE, B GETS EXECUTED }
  );
  </code></pre>
  
  <p>Any ideas what I'm doing wrong?</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT:</strong>
  Here's a rough timeline of what's happening:</p>
  
  <pre><code>---&gt; HTTP GET REQUEST B
  &lt;--- HTTP 200 REQUEST B RESPONSE (SUCCESS)
  
  ---&gt; HTTP GET REQUEST A
  &lt;--- HTTP 200 REQUEST A RESPONSE (FAILURE!)
  
  ---&gt; HTTP GET FALLBACK A
  ** onComplete() called! ---&gt; Subscriber never gets fallback response since onComplete() gets called before time.
  &lt;--- HTTP 200 FALLBACK A RESPONSE (SUCCESS)
  </code></pre>
  
  <p>And here's a link to a simple diagram I made which represent's what I want to happen:
  <a href="http://postimg.org/image/3p0ezxp97/" rel="noreferrer">Diagram</a></p>