title: is there a propper way to concatenate the following chain of observables?
body: <p>I want to execute an observable after a chain of observables completes. This chain of observables is an array converted in an observable. So I cannot make a simple concatenation because it will get executed every time.</p>
  <p>I have used the following approach using skipUnitl(last()) but it gets executed when the first chain of observables emits its first value. At the end I would need an operator that allowed me to execute the second observable once the first chain of observables is completed.</p>
  <p>This is how I have it right now and it doesn't work:</p>
  <pre><code>const typDb$ = Observable.from(this.typificationsShowed)
        .pipe(
          concatMap((response: QueuesTypificationShowed) =&gt; {
            return Observable.from(response.ouList);
          })
        )
        .pipe(
          //Hacemos un observable por cada vez que se ha añadido la tipificacion
          concatMap((response: OuCount) =&gt; {
            return Observable.from(
              Array.from({ length: response.count }, (i) =&gt; response.ou)
            );
          }),
          concatMap((response: QueuesTypificationOu) =&gt; {
            const e: AttentionTypification = new AttentionTypification();
            e.queuesTypificationId = response.queuesTypificationId;
            e.attentionId = this.attentionService.actualAttention.attentionId;
            return this.attentionTypificationService.create(e);
          }))
        
  
      let typificationsOrchestra: Array&lt;Typification&gt; = this.queuesTypificationService.setOrchestraTypifications();
  
      const typOrchestra$ =  this.queueManagerService.setTypifications(typificationsOrchestra, this.currentUser)
        .pipe(
          concatMap((response: UserStatus) =&gt; {
            console.log(response);
            return this.queueManagerService.endAttention(response);
          }),
          tap((response:UserStatus)=&gt; {
            this.queueManagerService.userSource.next(response);
          })
        )
       
      //No ejecutamos el observable hasta que se ha emitido el último valor del observable typDb$
      typOrchestra$.skipUntil(typDb$.pipe(last()))
      .subscribe(...)
  </code></pre>
  <p>So typOrchestra$ should get executed once all the members of the typDb$ have been treated.</p>
  <p>I have succeded in doing this by subscribing to typDb$ and emiting a value of a subject in complete(). Then in typOrchestra$ I listen to this subject and when it emits the proper value the chain continues.</p>
  <pre><code>const typDb$ = Observable.from(this.typificationsShowed)
    .pipe(
    concatMap((response: QueuesTypificationShowed) =&gt; {
      return Observable.from(response.ouList);
    })
    )
    .pipe(
    //Hacemos un observable por cada vez que se ha añadido la tipificacion
    concatMap((response: OuCount) =&gt; {
      return Observable.from(
        Array.from({ length: response.count }, (i) =&gt; response.ou)
      );
    }),
    concatMap((response: QueuesTypificationOu) =&gt; {
      const e: AttentionTypification = new AttentionTypification();
      e.queuesTypificationId = response.queuesTypificationId;
      e.attentionId = this.attentionService.actualAttention.attentionId;
      return this.attentionTypificationService.create(e);
    })).subscribe(() =&gt; {
  
    }, error =&gt; {
  
    }, () =&gt; {
      endAttentionSource.next(&quot;complete&quot;);
    }
    );
  
  //No ejecutamos el observable hasta que se ha completado el observable que inserta las tipificaciones en la base de datos.
  endAttSubscription = endAttention
  .pipe(
    filter((response: string) =&gt; response == 'complete'),
    //Now it concatenates the observables of typOrchestra$
  </code></pre>
  <p>But this approach doesn't seem to me as a clean one. Do you know how to do it in a propper manner?</p>
  <p>Thanks!</p>