https://kotlinlang.org logo
#android
Title
# android
l

lexardi

09/10/2018, 11:05 AM
Hi guys, does anyone use kotlin coroutines and rx in one project in production? I'd like to substitute rx, but coroutines streams (Channels) seems a bit "excessive"
g

gildor

09/10/2018, 12:23 PM
#coroutines
What is your question? Channels is part of kotlinx.coroutines core module (at least for now)
l

lexardi

09/10/2018, 1:01 PM
Is it good tendency to use both libraries in the project? is it possible to replace the use of rx, if the application has a large number of streams?
g

gildor

09/10/2018, 2:15 PM
Maybe make sense to post to #coroutines to hear more opinions. I see nothing wrong to use both libraries, kotlinx.coroutines even have adapter library for RxJava. Single, Maybe and Completable can be easily replaced by suspend functions and you will get better anr more obvious code If we talking about streams it's also possible, but Channels are pretty different from default Rx streams, they are hot and optimized for cross-thread usage. Also Rx has much wider set of stream operators, but writing own operators using coroutines is much easier There is proposal also about cold streams abstraction for kotlinx.coroutines, which would be closer to Rx behavior and optimize some use cases when cold straems are more efficient. Also it doesn't look like realistic strategy to rewrite some project from Rx coroutines without interop
a

Ahmed Mamdouh

09/10/2018, 8:08 PM
I'm not so experienced with coroutines but i use both in one project, because in my case i use rx for reactive cases like in Room , but otherwise coroutines seems perfect and way simpler to get asynchronous.
2 Views