Antanas A.
05/24/2019, 12:45 PMgildor
05/24/2019, 1:11 PMgildor
05/24/2019, 1:12 PMgildor
05/24/2019, 1:12 PMAntanas A.
05/24/2019, 1:23 PMclass Module(inputStream) {
val broadcast = inputStream.broadcast()
// multi usage: launch { broadcast.consumeEach { ... } }
fun output() = broadcast.openSubscription().map(...)
}
It's all ok with a consumeEach as you said, but it's not ok with channels which is returned by output() function
because they are outside of controllable scope of a moduleAntanas A.
05/24/2019, 1:23 PMAntanas A.
05/24/2019, 1:24 PMAntanas A.
05/24/2019, 1:25 PMAntanas A.
05/24/2019, 1:25 PMAntanas A.
05/24/2019, 1:33 PMbroadcast()
will connect to inputStream
channel and consumes from that forevergildor
05/24/2019, 3:01 PMgildor
05/24/2019, 3:02 PMgildor
05/24/2019, 3:03 PMlouiscad
05/24/2019, 6:53 PMasFlow
for a BroadcastChannel
will not solve the issue as a BroadcastChannel
stays hot while it's not been explicitly closed with close()
.gildor
05/25/2019, 12:46 AMgildor
05/25/2019, 12:47 AMMatej Drobnič
05/25/2019, 6:26 AMMatej Drobnič
05/25/2019, 6:26 AM