@FlowPreview fun <T : Any> Publisher<T>.asFlow(
    batchSize: Int
): Flow<T>

Deprecated: batchSize parameter is deprecated, use .buffer() instead to control the backpressure

fun <T : Any> Publisher<T>.asFlow(): Flow<T>

Transforms the given reactive Publisher into Flow. Use buffer operator on the resulting flow to specify the size of the backpressure. More precisely, it specifies the value of the subscription’s request. buffer default capacity is used by default.

If any of the resulting flow transformations fails, subscription is immediately cancelled and all in-flight elements are discarded.

This function is integrated with ReactorContext from kotlinx-coroutines-reactor module, see its documentation for additional details.