Inside flatMap, you need to split the filledColl into smaller parts, hold each part and merge them all into one observable, which you will return inside flatMap.
generate(coll).flatMap({ filledColl -> def chunkSize = 100 resultStream = rx.Observable.never() for (i in 0 ..< filledCol.size()/chunkSize) { def chunk = filledCol[i*chunkSize .. (i+1)*chunkSize] resultStream = resultStream.mergeWith( rx.Observable.from(chunk).delay(100*i, TimeUnit.MILLISECONDS) ) } resultStream }).subscribe({ ... })
This is just a tough idea, you can still test, configure and fix according to your needs. In addition, it might make sense to move this to the generation function, but it is up to you, since I cannot know what is in the generation ().
source share