diesieben07
01/09/2020, 9:43 AMFlow.asObservable
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-L96diesieben07
01/09/2020, 1:20 PMSubscriptionChannel
) 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 Powell
01/09/2020, 9:38 PMdiesieben07
01/09/2020, 9:43 PMobservable 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
Flow
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 Channel
, which can only be consumed once.diesieben07
01/09/2020, 9:45 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:34 PMFlowable
because Observable
doesnât have backpressure.
But youâre talking about sharing, which is a separate issue from backpressure?diesieben07
01/09/2020, 10:35 PMObservable
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 request
if you want more items).diesieben07
01/09/2020, 10:36 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:37 PMObservable
does have backpressure, but in Rx2 there are two parallel types, Flowable
and Observable
, and the only difference is Flowable
has backpressure and Observable
does not.diesieben07
01/09/2020, 10:38 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:39 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:40 PMObservable
one, but youâll notice request tracking and stuffZach Klippenstein (he/him) [MOD]
01/09/2020, 10:40 PMPublisher
is the generic âreactive streamsâ version of RxJavaâs Flowable
, and Flowable
actually implements the Publisher
interface)diesieben07
01/09/2020, 10:41 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:42 PMdiesieben07
01/09/2020, 10:42 PMdiesieben07
01/09/2020, 10:42 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:44 PMdiesieben07
01/09/2020, 10:47 PMZach Klippenstein (he/him) [MOD]
01/09/2020, 10:58 PM