# coroutines


04/09/2019, 5:27 PM
I'm looking into replacing a server-side app (kind of an API gateway) which uses RxJava with coroutines instead. Often, there are calls across 7+ different microservices, which are managed using Observables (emitted by Hystrix), which really are Single<T>, i.e. they are not reactive streams but rather emit a single value. The reactive streams are more used for orchestrating parallel requests rather than that the async nature of these calls are the real benefit. What kind of patterns for coroutines exist for replacing for example,, when all that you zip are streams emitting single values? Just await() ?


04/09/2019, 6:48 PM
I don't know if I understood the question but the difference between them is that with Rx you apply operators (from library) on streams and with coroutines you can get directly the value as a synchronous code and apply whatever u want on that value like:
Copy code
val first = firstRequest()
val second = secondRequest()
zip(first.await(), second.await()) // your own implementation of zip