kafkaReceiverFlow

fun <K, V> kafkaReceiverFlow(options: MutableReceiverOptions<K, V>.() -> Unit): Flow<ReceiverRecord<K, V>>

This function creates a KafkaReceiver and converts it into a Flow using provided options.

Return

a Flow of ReceiverRecord.

Example usage:

val flow = kafkaReceiverFlow<String, String> {
keyDeserializer { _, data -> String(data) }
valueDeserializer { _, data -> String(data) }

properties {
BOOTSTRAP_SERVERS_CONFIG to "localhost:9092"
GROUP_ID_CONFIG to "my-group-id"
AUTO_OFFSET_RESET_CONFIG to "earliest"
}
}
flow.collect { record -> println(record.value()) }

Parameters

options

A lambda with receiver to configure MutableReceiverOptions.