Back to Kotlinx Coroutines

Module kotlinx-coroutines-reactive

reactive/kotlinx-coroutines-reactive/README.md

1.10.23.7 KB
Original Source

Module kotlinx-coroutines-reactive

Utilities for Reactive Streams.

Coroutine builders:

NameResultScopeDescription
kotlinx.coroutines.reactive.publishPublisherProducerScopeCold reactive publisher that starts the coroutine on subscribe

Integration with Flow:

NameResultDescription
Publisher.asFlowFlowConverts the given publisher to a flow
Flow.asPublisherPublisherConverts the given flow to a TCK-compliant publisher

If these adapters are used along with kotlinx-coroutines-reactor in the classpath, then Reactor's Context is properly propagated as coroutine context element (ReactorContext) and vice versa.

Suspending extension functions and suspending iteration:

NameDescription
Publisher.awaitFirstReturns the first value from the given publisher
Publisher.awaitFirstOrDefaultReturns the first value from the given publisher or default
Publisher.awaitFirstOrElseReturns the first value from the given publisher or default from a function
Publisher.awaitFirstOrNullReturns the first value from the given publisher or null
Publisher.awaitLastReturns the last value from the given publisher
Publisher.awaitSingleReturns the single value from the given publisher
<!--- MODULE kotlinx-coroutines-core --> <!--- INDEX kotlinx.coroutines --> <!--- INDEX kotlinx.coroutines.flow --> <!--- INDEX kotlinx.coroutines.channels --> <!--- MODULE kotlinx-coroutines-reactive --> <!--- INDEX kotlinx.coroutines.reactive --> <!--- END -->

Package kotlinx.coroutines.reactive

Utilities for Reactive Streams.