Commit 563327be authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add key from id field to message

parent 5f0e2a54
......@@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import java.io.StringReader
import java.io.StringWriter
import org.apache.kafka.streams.KeyValue
import org.apache.kafka.streams.StreamsBuilder
import org.apache.kafka.streams.Topology
import org.apache.logging.log4j.LogManager
......@@ -42,6 +43,7 @@ class KafkaTopology(private val settings: SettingsLoader) {
.flatMapValues { value -> parseJson(value) }
.mapValues { value -> unpackJson(value) }
.mapValues { value -> transformJson(value) }
.map { _, value -> KeyValue(value.id, value) }
.mapValues { value ->
val writer = StringWriter()
ObjectMapper().registerKotlinModule().writeValue(writer, value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment