mono

fun <T> mono(
    context: CoroutineContext = EmptyCoroutineContext,
    block: suspend CoroutineScope.() -> T?
): Mono<T>

Creates cold mono that will run a given block in a coroutine. Every time the returned mono is subscribed, it starts a new coroutine. Coroutine returns a single, possibly null value. Unsubscribing cancels running coroutine.

Coroutine action Signal to sink
Returns a non-null value success(value)
Returns a null success
Failure with exception or unsubscribe error

Coroutine context can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used.

Method throws IllegalArgumentException if provided context contains a Job instance.