Mark Vogel
12/29/2022, 3:45 PMChannel
intended to fully replace Java's Queue
? More specifically, for a high traffic message processing environment, should I attempt to use a ReceiveChannel
instead of ConcurrentLinkedQueue
?
I'm thinking that the answer is yes, but if anyone can provide some reference to the intent here I'd appreciate it!CLOVIS
12/29/2022, 4:01 PMChannel(capacity = UNLIMITED)
is intended as a replacement for ConcurrentLinkedQueue
, yes, but I'm not an expertMark Vogel
12/29/2022, 4:03 PMAdam S
12/29/2022, 6:21 PMCLOVIS
12/29/2022, 6:21 PMMark Vogel
12/29/2022, 6:21 PMCLOVIS
12/29/2022, 6:22 PMMark Vogel
12/29/2022, 6:27 PMChannel
serves a very similar purpose, but allowing for the power of suspending when there is nothing received.
However, I can find very little documentation or discussion on this kind of thing for referenceCLOVIS
12/29/2022, 6:28 PMCLOVIS
12/29/2022, 6:29 PMAdam S
12/29/2022, 6:30 PMConceptually shared flow is similar to BroadcastChannel and is designed to completely replace it.https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-shared-flow/
Mark Vogel
12/29/2022, 6:34 PMChannel
is correct for my use case, but I also appreciate the extra info on flows as I've only read up on the cold flows much. I will definitely be able to make use of those in other reactive areas of my projectskevin.cianfarini
01/03/2023, 6:09 PMDo not communicate by sharing memory; instead, share memory by communicating.Channels should be used for this exact reason.