/kafkaflow

A library that allow you to confuse messages from a Kafka topic as a Kotlin flow

Primary LanguageKotlin

Small utility to retrieve current and future records from Kafka topics in a flow, written in Pure Kotlin.

Attach to a topic and retrieve future messages

val kafkaFlow = KafkaFlow<String>(bootstrapServers, StringDeserializer::class.java)
val twoMessagesFromTopic = kafkaFlow.startFlow("a.Topic").take(2).toList()

You can also simply stream "forever"

val kafkaFlow = KafkaFlow<String>(bootstrapServers, StringDeserializer::class.java)

kafkaFlow.startFlow("a.Topic").collect {
    logger.info { "Just got this string from the topic: $it"}  
}

Get messages from the last time(TODO: Stateful)