diesieben0701/09/2020, 9:43 AM
it just dumps the flow into the emitter as fast it can, without regard for the backpressure mechanisms 😞 (https://github.com/Kotlin/kotlinx.coroutines/blob/master/reactive/kotlinx-coroutines-rx2/src/RxConvert.kt#L80-L107). The opposite (convert Observable into ReceiveChannel) does the same: https://github.com/Kotlin/kotlinx.coroutines/blob/master/reactive/kotlinx-coroutines-rx2/src/RxChannel.kt#L65-L96
) as a basis, but even that I can't do, because there are no channel implementations in the coroutines library that are subclassable (it's all internal). You have to always implement everything from scratch... is this by design? If so, why?
Adam Powell01/09/2020, 9:38 PM
diesieben0701/09/2020, 9:43 PM
observable doesn't do backpressureHuh? https://github.com/ReactiveX/RxJava/wiki/Backpressure
https://github.com/Kotlin/kotlinx.coroutines/blob/master/reactive/kotlinx-coroutines-reactive/src/ReactiveFlow.kt might be a more useful exampleA
is not what I want. The context is gRPC, so a remote procedure call. It has to be predictable when and how often it happens. I don't want the call to happen twice if you accidentally consume the flow twice. That is why I specifically want a
, which can only be consumed once.
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:34 PM
doesn’t have backpressure. But you’re talking about sharing, which is a separate issue from backpressure?
diesieben0701/09/2020, 10:35 PM
in RxJava not have backpressure? I am not a user of RxJava, but reading the above link it seems it very much has (by calling
if you want more items).
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:37 PM
does have backpressure, but in Rx2 there are two parallel types,
, and the only difference is
has backpressure and
diesieben0701/09/2020, 10:38 PM
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:39 PM
one, but you’ll notice request tracking and stuff
is the generic “reactive streams” version of RxJava’s
actually implements the
diesieben0701/09/2020, 10:41 PM
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:42 PM
diesieben0701/09/2020, 10:42 PM
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:44 PM
diesieben0701/09/2020, 10:47 PM
Zach Klippenstein (he/him) [MOD]01/09/2020, 10:58 PM