can process individual items in parallel by collectors? Or is it an internal "fan out". I just want to process a queue of emissions in parallel. Thanks!
Copy code
val flow = channel.receiveAsFlow()
repeat(5) { launch { flow.collect { /*receive channel item in separate coroutine */ } } }
n
Nick Allen
01/23/2022, 12:20 AM
Your code snippet is basically equivalent to:
Copy code
repeat(5) { launch { channel.consumeEach { /*receive channel item in separate coroutine */ } } }
Items are processed concurrently, not sequentially.