日志压缩主题不应该针对相同的键保留重复项。但在我们的例子中,当发送具有相同键的新值时,不会删除前一个值。可能是什么问题?
val TestCompactState: KTable[String, TestCompact] = builder.table[String, TestCompact](kafkaStreamConfigs.getString("testcompact-source"),
(TestCompactmaterialized).withKeySerde(stringSerde).withValueSerde(TestCompactSerde))
Run Code Online (Sandbox Code Playgroud)
我得到的 实际结果
Offsets Keys Messages
5 {"id":5} {"id":5,"namee":"omer","__deleted":"false"}
6 {"id":5} {"id":5,"namee":"d","__deleted":"false"}
Run Code Online (Sandbox Code Playgroud)
我只想要针对相同关键预期结果的最新记录
6 {"id":5} {"id":5,"namee":"d","__deleted":"false"}
Run Code Online (Sandbox Code Playgroud) apache-kafka kafka-producer-api apache-kafka-streams apache-kafka-connect kafka-topic