kafkaSenderChannel

fun <K, V, T> CoroutineScope.kafkaSenderChannel(options: MutableSenderOptions<K, V>.() -> Unit): Channel<SenderRecord<K, V, T>>

This function creates a Channel for SenderRecord in the CoroutineScope using provided options.

Return

a Channel of SenderRecord.

Example usage:

coroutineScope {
    val senderChannel = kafkaSenderChannel<String, String, Unit> {
        keySerializer { _, data -> data.encodeToByteArray() }
        valueSerializer { _, data -> data.encodeToByteArray() }

        properties {
            BOOTSTRAP_SERVERS_CONFIG to "localhost:9092"
        }
    }

    senderChannel.send(SenderRecord.create(record, Unit))
}

Parameters

options

A lambda with receiver to configure MutableSenderOptions.