Oliver Eisenbarth
07/28/2021, 3:05 PMsimon.vergauwen
07/28/2021, 3:10 PMEnvironment
doesn’t exist anymore, and you can simply use runBlocking
from KotlinX if you need to.
But Ktor is full of suspend
APIs, especially in routing
, so I think you’re not looking in the right place.simon.vergauwen
07/28/2021, 3:12 PMsuspend
I typically use CompletableFuture
.
https://github.com/joost-de-vries/spring-coroutine
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/index.html
With these two dependencies you can safely launch coroutines as CompletableFuture without breaking cancellation.simon.vergauwen
07/28/2021, 3:12 PMsuspend
APIs that are built on top of Project Reactor such as coRouter
which has a suspend
DSL inside.Oliver Eisenbarth
07/28/2021, 4:25 PMEnvironment
is gone? Guess my course material is outdated. 😀
I think, I did not make myself really clear, so please let my correct my intention: I did not find suspended endpoints in the Ktor docs. And while I did find some suspended functions in their github after you answered, I still feel unshure about how to use it with Arrow Fx - it's not like 'coRouter' that imho clearly states "here be coroutines". So I'm really looking forward to the KTOR backend project you mentioned in the other thread! 🦜
Suspended endpoints in Spring...man, they always get me so confused. I forget about WebFlux / Reactor and have to look up for the n-th time, if there's support for suspend endpoitns in MVC. Did so (again) and found that there would be no need for runBlocking { ... } for Spring Framework 5.3 and Spring Boot 2.4 (meaning you can just use suspend as in webflux). But I guess I will have forgotten that again after hitting enter. 😬
Thank you very much for the detailed answer and the links! 🙏simon.vergauwen
07/28/2021, 4:28 PMsimon.vergauwen
07/28/2021, 4:29 PMsimon.vergauwen
07/28/2021, 4:29 PMOliver Eisenbarth
07/28/2021, 4:33 PMOliver Eisenbarth
07/29/2021, 3:32 PMOliver Eisenbarth
07/29/2021, 3:34 PMrouter {}
dsl, though. But the annotation based controller functions can be suspended: @GetMapping(value = ["/parZip"]) suspend fun parZip(): ResponseEntity<String> {
simon.vergauwen
07/29/2021, 7:54 PMOliver Eisenbarth
08/04/2021, 2:55 PM