I have a single Kafka topic with multiple user info events for multiple different users. I'm trying to figure out how to to aggregate these together using a number of fields from the value.
For example:
Input Topic:
1:{"SSN":"123456"}
2:{"twitterHandle":"elvis"}
3:{"SSN":"123456","twitterHandle":"elvis","accountNum": "111111"}
4:{"SSN":"123456"}
5:{"SSN":"000000"}
6:{"twitterHandle":"foo"}
7:{"SSN":"000000","twitterHandle":"foo"}
8:{"SSN":"000000"}
I want an Output Topic (aggregated):
{"SSN":"123456","twitterHandle":"elvis","accountNum": "111111"}
{"SSN":"000000","twitterHandle":"foo"}
How can I achieve this with Kafka Streams? Can I create a KStream from Input Topic and convert it to a KTable to get output Topic?
Update: The topic contains events from multiple different users. The user identifiers (SSN, twitterHandle) are not fixed. There maybe other ids for a users