Hi! I'm newbie in coroutines. I'm wondering how I can make Spring's RestTemplate work with coroutines? I'm going to check ktor's source code. But from my perspective, network intercation in RestTemplate is blocking and there will be no improvement with coroutines. Am I right?
e
enleur
09/25/2018, 3:13 PM
nope, you should run it on IO pool
d
darych
09/25/2018, 3:14 PM
Sorry, didn't get it. Run RestTemplate on IO pool?
e
enleur
09/25/2018, 3:18 PM
yes, you wrap a blocking call with IO context and use it in your coroutines
👍 1
d
darych
09/25/2018, 3:19 PM
Oh, thank you. Will try find some info on this.
e
enleur
09/25/2018, 3:23 PM
Copy code
withContext(<http://Dispatchers.IO|Dispatchers.IO>){
.. your blocking code
}