Hi guys, does anyone use kotlin coroutines and rx ...
# android
l
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
#coroutines
What is your question? Channels is part of kotlinx.coroutines core module (at least for now)
l
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
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
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.