-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Hi all,
I have a question regarding the scheduling of background tasks.
On some requests that I proxy I would like to start an asynchronous task in the background.
The request should continue without waiting for the background task.
So far I have not found a way of continuing the request on the default scheduler after publishing the background task on my custom scheduler:
override fun filter(exchange: ServerWebExchange, chain: GatewayFilterChain): Mono<Void> {
return Mono.just("bla")
.publishOn(someCustomScheduler)
.doOnNext {
// do something expensive here
println(it)
}
// how to return to default scheduler here?
.flatMap {
chain.filter(exchange)
}
}
I can't find a way of getting a handle on the default scheduler. Is it possible to get it somehow?
Or is my approach wrong anyway?