kotka-streams-extensions
Contains the basic extension functions to make Kafka Streams more Kotlin-esque.
implementation("dev.adamko.kotka:kotka-streams-extensions:$kotkaVersion")
Content copied to clipboard
import dev.adamko.kotka.extensions.tables.*
import dev.adamko.kotka.extensions.streams.*
import dev.adamko.kotka.extensions.*
data class MusicalBand(
val name: String,
val memberNames: List<String>,
)
builder.stream<String, MusicalBand>("musical-bands")
.flatMap("band-member-names-to-band-name") { _: String, band: MusicalBand ->
band.memberNames.map { memberName -> memberName to band.name }
}
.groupByKey(groupedAs("map-of-band-member-to-band-names"))
Content copied to clipboard