There are several http-requests observers that start at the start of the application in parallel, generating some stream of entities for further processing (doSomething). Suppose request1, request2, request3
There is one observer that also starts when the application starts in parallel with these requests, generating only onComplete. Let's say init
We need to do this so that for these three threads, doSomething starts working as soon as init returns onComplete.
At the same time, any of the requests can reach the processing stage both earlier and later onComplete.
Now I’ve done this with a creepy build with a boolean readiness flag of this form in init:
Observer<Boolean> init = Observer.just(null) .repeatWhen(o->o.delay(1,TimeUnit.SECONDS)) .map(o->isready).filter(o->o).take(1); and for each request stuck it
Observable.concat(init, requestN).skip(1).doSomething(...).subscribe(); But I feel that this is akin to the removal of the glands through the anus. How to do right?