kotka-streams-kotlinx-serialization
Use Kotlinx Serialization for topic key/value serdes.
implementation("dev.adamko.kotka:kotka-streams-kotlinx-serialization:$kotkaVersion")
Content copied to clipboard
import dev.adamko.kotka.extensions.tables.*
import dev.adamko.kotka.extensions.streams.*
import dev.adamko.kotka.extensions.*
import dev.adamko.kotka.topicdata.*
import dev.adamko.kotka.kxs.*
val jsonMapper = Json {}
@Serializable
data class Sku(
val sku: String
)
@Serializable
data class ShopItem(
val id: Sku,
val name: String,
) : TopicRecord<Sku> {
override val topicKey: Sku by ::id
}
object ShopItemTopic : TopicDefinition<Long, ShopItem> {
override val topicName = "shop-item-updates"
override val serdes = KeyValueSerdes.kxsJson(jsonMapper)
}
Content copied to clipboard