kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suresh Chidambaram <chida.sur...@gmail.com>
Subject Previous State of a Kafka Message
Date Sun, 06 Dec 2020 14:39:23 GMT
Hi,

Greetings!

My requirement is as below.

I have Topic named  "sample-topic".  This topic contains the same keys(as
String) with multiple messages and the messages are in JSON format. I would
like to merge the JSON messages and produce a final JSON. In order to
achieve this, how to maintain the state of the previous message?

Below are the input messages in the topic.

Key : 0       Message: {    "attr1" : "value1", "attr2" : "value_01",
"attr3" :"value_3" }

Key : 1       Message: {     "attr1": "value_x", "attr2": "value2" ,
"attr3" : "value_y"}

Key : 2       Message: {     "attr1": "value_m", "attr2": null , "attr3" :
"value_o"}


Now, I need the resultant JSON as below.

{ "attr1": "value_m", "attr2": "value2" , "attr3" : "value_o"}


Could someone help me by letting me know the solution? Thank you.

Thanks

C Suresh

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message