Skip to content

Commit 40de24a

Browse files
committed
Reword docs for the Reactor integration
1 parent 71df60e commit 40de24a

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

reactive/kotlinx-coroutines-reactor/src/Convert.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public fun <T> Deferred<T?>.asMono(context: CoroutineContext): Mono<T> = mono(co
4141
/**
4242
* Converts a stream of elements received from the channel to the hot reactive flux.
4343
*
44-
* Every subscriber receives values from this channel in **fan-out** fashion. If the are multiple subscribers,
45-
* they'll receive values in round-robin way.
44+
* Every subscriber receives values from this channel in a **fan-out** fashion. If the are multiple subscribers,
45+
* they'll receive values in a round-robin way.
4646
* @param context -- the coroutine context from which the resulting flux is going to be signalled
4747
*/
4848
@Deprecated(message = "Deprecated in the favour of consumeAsFlow()",

reactive/kotlinx-coroutines-reactor/src/Flux.kt

+10-9
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ import org.reactivestreams.*
1111
import reactor.core.*
1212
import reactor.core.publisher.*
1313
import reactor.util.context.*
14+
import java.lang.IllegalArgumentException
1415
import kotlin.coroutines.*
1516

1617
/**
17-
* Creates cold reactive [Flux] that runs a given [block] in a coroutine.
18+
* Creates a cold reactive [Flux] that runs a given [block] in a coroutine.
1819
* Every time the returned flux is subscribed, it starts a new coroutine in the specified [context].
19-
* Coroutine emits ([Subscriber.onNext]) values with `send`, completes ([Subscriber.onComplete])
20-
* when the coroutine completes or channel is explicitly closed and emits error ([Subscriber.onError])
21-
* if coroutine throws an exception or closes channel with a cause.
22-
* Unsubscribing cancels running coroutine.
20+
* Coroutine emits ([Subscriber.onNext]) values with [send][ProducerScope.send], completes ([Subscriber.onComplete])
21+
* when the coroutine completes, or the channel is explicitly closed and emits an error ([Subscriber.onError])
22+
* if the coroutine throws an exception or closes the channel with a cause.
23+
* Unsubscribing cancels the running coroutine.
2324
*
24-
* Invocations of `send` are suspended appropriately when subscribers apply back-pressure and to ensure that
25-
* `onNext` is not invoked concurrently.
26-
*
27-
* Method throws [IllegalArgumentException] if provided [context] contains a [Job] instance.
25+
* Invocations of [send][ProducerScope.send] are suspended appropriately when subscribers apply back-pressure and to
26+
* ensure that [onNext][Subscriber.onNext] is not invoked concurrently.
2827
*
2928
* **Note: This is an experimental api.** Behaviour of publishers that work as children in a parent scope with respect
3029
* to cancellation and error handling may change in the future.
30+
*
31+
* @throws IllegalArgumentException if the provided [context] contains a [Job] instance.
3132
*/
3233
@ExperimentalCoroutinesApi
3334
public fun <T> flux(

reactive/kotlinx-coroutines-reactor/src/ReactorContext.kt

+9-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ import kotlin.coroutines.*
1010
import kotlinx.coroutines.reactive.*
1111

1212
/**
13-
* Wraps Reactor's [Context] into [CoroutineContext] element for seamless integration Reactor and kotlinx.coroutines.
14-
* [Context.asCoroutineContext] is defined to add Reactor's [Context] elements as part of [CoroutineContext].
15-
* Coroutine context element that propagates information about Reactor's [Context] through coroutines.
13+
* Wraps Reactor's [Context] into a [CoroutineContext] element for seamless integration between
14+
* Reactor and kotlinx.coroutines.
15+
* [Context.asCoroutineContext] is defined to place Reactor's [Context] elements into a [CoroutineContext],
16+
* which can be used to propagate the information about Reactor's [Context] through coroutines.
1617
*
17-
* This context element is implicitly propagated through subscriber's context by all Reactive integrations, such as [mono], [flux],
18-
* [Publisher.asFlow][asFlow], [Flow.asPublisher][asPublisher] and [Flow.asFlux][asFlux].
19-
* Functions that subscribe to the reactive stream (e.g. [Publisher.awaitFirst][kotlinx.coroutines.reactive.awaitFirst])
20-
* also propagate the [ReactorContext] to the subscriber's [Context].
18+
* This context element is implicitly propagated through subscriber's context by all Reactive integrations,
19+
* such as [mono], [flux], [Publisher.asFlow][asFlow], [Flow.asPublisher][asPublisher] and [Flow.asFlux][asFlux].
20+
* Functions that subscribe to the reactive stream
21+
* (e.g. [Publisher.awaitFirst][kotlinx.coroutines.reactive.awaitFirst]), too, propagate [ReactorContext]
22+
* to the subscriber's [Context].
2123
**
2224
* ### Examples of Reactive context integration.
2325
*

0 commit comments

Comments
 (0)