I am in need that i need to start the coroutines from rxkotlin chain, But am i not sure whether this is right or wrong, to start a coroutines from the rx chain i use runblocking
to start the suspend methods
Example
Single.just(someOperation())
.map{
someMethod(it)
}
.flatMap{
startCoroutines(suspend { someOpeartions() } ) // i will be starting the coroutines here
}
Coroutines
fun startCoroutines(suspendingObj : suspend () -> Any){
runBlocking(newFixedThreadPoolContext(1,"Thread")){
suspendingObj.invoke()
}
}
Is this above code is correct way of doing it or is there is any other way to achieve this ? Can anyone help me out with this