I'm new to reactive programming and stuck at a probably simple point. I have two methods returning observables.
GetQueues(): Observable<Queue[]>{...}
and
GetMessageCount(queue: Queue): Observable<number>{...}
Now I want to chain these in a method with the following signature
GetAllQueueMessageCount(): Observable<number>{...}
As you can imagine, I want to call the first method to read a list of queues, iterate over the result and call the second one for each of them.
I can imagine something like the following, but as you see, this doesn't return what the signature expects:
public GetAllQueueMessageCount(): Observable<number> {
    var messageCount = 0;
    this.GetQueues()
        .subscribe(queues => {
            var queueCountRequests = [];
            queues.forEach((queue) => {
                queueCountRequests.push(this.GetQueueMessageCount(queue));
            });
            Observable.forkJoin(queueCountRequests)
                .subscribe(t => {
                    t.forEach(
                        count => messageCount = messageCount + (count as number));
                });
        }, error => Observable.throw(error));
}
All my attempts using flatMap resulted in the same.