https://kotlinlang.org logo
#announcements
Title
# announcements
m

Mehdi

08/31/2019, 8:48 AM
What is the difference between using Coroutine and KotlinRx? or we could use them both?
g

gildor

09/01/2019, 7:17 AM
What is KotlinRx?
m
g

gildor

09/01/2019, 11:46 PM
It's RxKotlin
RxKotlin just a collection of extension function that adds some Kotlin goodies on top of RxJava, it's not reactive framework itself
So your question about RxJava and Coroutines?
You can use them both together, there is even kotlinx.coroutines adapter library for RxJava types Should or not you use them together depends on many factors (do you have any of them in your project is the biggest one) Difference of course in implementation and syntax. I would say that work with Coroutines suspend functions is much better than with RxJava Single/Completable/Maybe. In case of streams of.events Coroutines provide own abstraction for that: Flow, it's not so mature as RxJava Observable/Flowable and operators set is not complete, but solves the same set of problems and has own advantages because it based on suspend functions
m

Mehdi

09/02/2019, 9:13 AM
Thanks @gildor for correcting and clarifying this🙏
g

gildor

09/02/2019, 9:29 AM
Also, just our own example. In our new project we use kotlinx.coroutines for everything, suspend functions, Flow, Channels But for our main project we migrating from Single/Completable to suspend functions, but we still have both. Also for now we do not plan migrate to Flow because RxJava works fine and it’s very easy to use it together with coroutines,
2 Views