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

Alexjok

06/15/2019, 10:33 AM
Hello! I have a code https://pl.kotl.in/raGwOPXXg How to do exactly the same but with Flow?
t

tseisel

06/16/2019, 9:48 AM
The only part that changes when using
Flow
in your code is the way input data is generated : https://pl.kotl.in/z0ms0AL48 There is no
parallelMap
operator that I am aware of, that allows to distribute the
map
operation to a given number of workers. For that part, you still need to use `Channel`s.
Also, notice that I added
Dispatchers.Default
as a context of
launchProcessor
, so that creating 50 workers makes much more sense than with the single-threaded context of
RunBlocking
a

Alexjok

06/17/2019, 1:39 PM
Seisel thx, i rewrote it with channelFlow and use with WebFlux
4 Views