简体   繁体   English

在没有 scope 的情况下使用 RxJava 调用协程

[英]Call a coroutine using RxJava without a scope

I would like to know how I can call a coroutine using RxJava and without using any scope.我想知道如何使用 RxJava 调用协程而不使用任何 scope。

If I have如果我有

suspend fun fetchInfo()  {
    //some code here
}
  • Does it have to return an Observable??它必须返回一个 Observable 吗??
  • Caller should be able to specify the running thread (ie Schedulers.IO )调用者应该能够指定正在运行的线程(即 Schedulers.IO )
  • I might be able to use runBlocking but not sure how to connect everything.我也许可以使用 runBlocking 但不确定如何连接所有内容。

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM