openSubscription

fun <T> Publisher<T>.openSubscription(
    request: Int = 1
): ReceiveChannel<T>

Deprecated: Transforming publisher to channel is deprecated, use asFlow() instead

Subscribes to this Publisher and returns a channel to receive elements emitted by it. The resulting channel shall be cancelled to unsubscribe from this publisher.

Parameters

request -

how many items to request from publisher in advance (optional, one by default).

This method is deprecated in the favor of Flow. Instead of iterating over the resulting channel please use collect:

asFlow().collect { value ->
    // process value
}