https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Ahmed Ibrahim

02/15/2020, 9:30 PM
What's the equivalent of Rx's
PublishProcessor
in the Coroutines world?
From what I know that Coroutines has Channels but do they support the same backpressure capabilities as PublishProcessor?
s

streetsofboston

02/15/2020, 9:40 PM
A BroadcastChannel
a

Ahmed Ibrahim

02/15/2020, 9:42 PM
Thanks, however I know that ConflatedBroadcastChannel applies something like onBackpressureLatest(), is there something like onBackpressureBuffer? So that I don't want to lose any events that might get backpressured
s

streetsofboston

02/15/2020, 9:44 PM
Don't BroadcastChannel constructor(-function)s take a backpressure parameter? (I'm not sure, since I can't access kdoc easily) Update: they do have a
capacity
parameter, which you can use to configure the buffer/backpressure
👍 1
b

bdawg.io

02/15/2020, 11:30 PM
Conflated is only one of many different types of channels :) default is rendezvous if the producer is faster than the consumer, another is a fixed size buffer, and the other that I can remember right now is unlimited buffer which just builds up a linked list
9 Views