title: Asynchronous call with RxJava -Observables
body: <p>I'm trying to make asynchronous rest calls by implementing RxJava.
  Below is the implementation -</p>
  
  <pre><code>final Observable&lt;List&lt;A&gt;&gt; observableA = Observable.create(new Observable.OnSubscribe&lt;List&lt;A&gt;&gt;() {
      @Override
      public void call(Subscriber&lt;? super List&lt;A&gt;&gt; subscriber) {
          try {
              if (!subscriber.isUnsubscribed()) {
                  subscriber.onNext(//another Function call);
                  subscriber.onCompleted();
              }
          } catch (Exception e) {
              subscriber.onError(e);
          }
      }
  });
  
  final Observable&lt;List&lt;B&gt;&gt; observableB = Observable.create(new Observable.OnSubscribe&lt;List&lt;B&gt;&gt;() {
      @Override
      public void call(Subscriber&lt;? super List&lt;B&gt;&gt; subscriber) {
          try {
              if (!subscriber.isUnsubscribed()) {
                  subscriber.onNext(//another Function call);
                  subscriber.onCompleted();
              }
          } catch (Exception e) {
              subscriber.onError(e);
          }
      }
  });
  
  
  Observable&lt;List&lt;C&gt;&gt; reservationObserv = Observable.zip(observableA, observableB, new Func2&lt; List&lt;A&gt;, List&lt;B&gt; ,  List&lt;C&gt;&gt;() {
      @Override
      public List&lt;C&gt; call(final List&lt;A&gt; a, final List&lt;B&gt; b) {
          // Merge the response
          return c;
      }
  });
  </code></pre>
  
  <p>As of now, ObservableA is first executed and then ObservableB. 
  Can any one please suggest why the calls are not asynchronous.</p>
  
  <p>Thanks in advance. </p>
  
  <p>when I execute in the following way, observableB is executed first and then ObservableA</p>
  
  <pre><code>final Observable&lt;List&lt;A&gt;&gt; observableA = Observable.create(new  Observable.OnSubscribe&lt;List&lt;A&gt;&gt;() {
  
  @Override
  public void call(final Subscriber&lt;? super List&lt;A&gt;&gt; subscriber) {
      Runnable run = new Runnable() {
          @Override
          public void run() {
              // Delay of 1000ms
              subscriber.onNext(//calling a method);
              subscriber.onCompleted();
          }
      };
      executorService.execute(run);
  }
  });
  
  final Observable&lt;List&lt;B&gt;&gt; observableB = Observable.create(new Observable.OnSubscribe&lt;List&lt;B&gt;&gt;() {
  
  @Override
  public void call(final Subscriber&lt;? super List&lt;B&gt;&gt; subscriber) {
      Runnable run = new Runnable() {
          @Override
          public void run() {
              // No delay
              subscriber.onNext(//calling a method);
              subscriber.onCompleted();
          }
      };
      executorService.execute(run);
  }
  });
  
  
  Observable&lt;List&lt;C&gt;&gt; observableC = Observable.zip(observableA, observableB, new Func2&lt; List&lt;A&gt;, List&lt;B&gt; ,  List&lt;C&gt;&gt;() {
  @Override
  public List&lt;C&gt; call(final List&lt;A&gt; a, final List&lt;B&gt; b) {
      // Merge the response
      return c;
  }
  });
  </code></pre>