Package kotlinx.coroutines.reactor

Utilities for Reactor.

Types

ReactorContext

class ReactorContext

Wraps Reactor’s Context into CoroutineContext element for seamless integration Reactor and kotlinx.coroutines. Context.asCoroutineContext is defined to add Reactor’s Context elements as part of CoroutineContext. Coroutine context element that propagates information about Reactor’s Context through coroutines.

SchedulerCoroutineDispatcher

class SchedulerCoroutineDispatcher : 
    CoroutineDispatcher,
    Delay

Implements CoroutineDispatcher on top of an arbitrary Scheduler.

Extensions for External Classes

kotlinx.coroutines.CoroutineScope

kotlinx.coroutines.Deferred

kotlinx.coroutines.Job

kotlinx.coroutines.channels.ReceiveChannel

kotlinx.coroutines.flow.Flow

reactor.core.scheduler.Scheduler

reactor.util.context.Context

Functions

flux

fun <T> flux(
    context: CoroutineContext = EmptyCoroutineContext,
    block: suspend ProducerScope<T>.() -> Unit
): Flux<T>

Creates cold reactive Flux that runs a given block in a coroutine. Every time the returned flux is subscribed, it starts a new coroutine in the specified context. Coroutine emits items with send. Unsubscribing cancels running coroutine.

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.