Hey Folks, we are running an nice little spring-b...
# coroutines
Hey Folks, we are running an nice little spring-boot webflux service in Kotlin. To brigde between coroutines and the webflux world, we use org.jetbrains.kotlinx:kotlinx-coroutines-reactor. As you can see in this little example, I switch the context in the controller.
Copy code
class PageController(
    private val pageService: PageService,
) {
    private val context = <http://Dispatchers.IO|Dispatchers.IO>

    suspend fun getPage(
        @PathVariable slug: String,
    ): PageResponse = 
        withContext(context) { pageService.getPage(slug) }

My motivation is to keep the webflux threadpool clean from everything that does not relate to the request till it reaches the controller. But does really have an positiv affect on performance? Or does the context switch here is even bad because it comes with an cost?
You're doing the same thing as you'd do with Reactor so no difference
What do you mean? I switch context to
Copy code