toBlockable

fun <T> Mono<T>.toBlockable(scheduler: Scheduler = Schedulers.boundedElastic()): Mono<T>

Extension function that makes a Mono blockable by scheduling it on a separate thread if needed. If the current thread is non-blocking (reactive), it subscribes the Mono on the provided scheduler. If already on a blocking thread, returns the Mono unchanged.

Return

a Mono that will execute on an appropriate thread for blocking operations

Parameters

T

the type of data in the Mono

scheduler

the scheduler to use for blocking operations (defaults to bounded elastic)