vertx / io.vertx.kotlin.coroutines / io.vertx.core.streams.WriteStream / toChannel

toChannel

fun <T> WriteStream<T>.toChannel(vertx: Vertx, capacity: Int = 256): SendChannel<T>

Adapts the current write stream to Kotlin SendChannel.

The channel can be used to write items, the coroutine is suspended when the stream is full and resumed when the stream is drained.

Parameters

vertx - the related vertx instance

capacity - the channel buffering capacity

fun <T> WriteStream<T>.toChannel(context: Context, capacity: Int = 256): SendChannel<T>

Adapts the current write stream to Kotlin SendChannel.

The channel can be used to write items, the coroutine is suspended when the stream is full and resumed when the stream is drained.

Parameters

context - the vertx context

capacity - the channel buffering capacity