I got a Projekt to learn working with Kafka Streams, but I have really trouble with it. I am working on kafka-streams version 1.0.1. We have a Main Topic Stream with Messages with the following Style:
{
"phenomenonTime" : "2017-04-03T16:08:19.000Z",
"resultTime" : "2017-04-03T16:08:19.000Z",
"result" : {
"Temperature" : 0,
"Pressure" : 0,
"Humidity" : 0,
"Mean altitude" : 0,
"Mass PM2.5" : 7.4,
"Mass Error PM2.5" : 1.5,
"Mass PM10" : 12.3,
"Mass Error PM10" : 1.5
}
}
It's a Json Format, there is my first Probleme, I dont know how exactly use the Json Deserializer or Serializer.
But my Main Target is to create the Topics Temperature,Pressure,Humidity,Mean altitude... out of the Main Topic his Result Field with the right values in the Temperature Topic.
How can I realise that with Kafka Streams? I hope you can help me, to get better started with Kafka Streams.
EDIT:
Hole Message + key (formatted)
Key c45e9532-9810-11e8-8839-03e1e3365152
Value { "phenomenonTime" : "2017-04-03T16:08:09.000Z",
"resultTime" : "2017-04-03T16:08:09.000Z",
"result" : { "Temperature" : 0,
"Pressure" : 0,
"Humidity" : 0,
"Mean altitude" : 0,
"Mass PM2.5" : 7.1,
"Mass Error PM2.5" : 1.5,
"Mass PM10" : 9.6, "Mass Error PM10" : 1.5 },
"[email protected]" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')/Datastream",
"Datastream" : { "unitOfMeasurement" : { "name" : null, "symbol" : null, "definition" : null }, "@iot.id" : "geo.uni-augsburg.de/Fixed-Wing-UAV-1/Datastreams/LOAC_LOCAL_201704031605.mass" },
"[email protected]" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')/FeatureOfInterest",
"FeatureOfInterest" : { "@iot.id" : "c458a1a4-9810-11e8-8839-176a6dbe6951" }, "@iot.id" : "c45e9532-9810-11e8-8839-03e1e3365152", "@iot.selfLink" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')" }
Unformated:
Key c45e9532-9810-11e8-8839-03e1e3365152
Value { "phenomenonTime" : "2017-04-03T16:08:09.000Z", "resultTime" : "2017-04-03T16:08:09.000Z", "result" : { "Temperature" : 0, "Pressure" : 0, "Humidity" : 0, "Mean altitude" : 0, "Mass PM2.5" : 7.1, "Mass Error PM2.5" : 1.5, "Mass PM10" : 9.6, "Mass Error PM10" : 1.5 }, "[email protected]" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')/Datastream", "Datastream" : { "unitOfMeasurement" : { "name" : null, "symbol" : null, "definition" : null }, "@iot.id" : "geo.uni-augsburg.de/Fixed-Wing-UAV-1/Datastreams/LOAC_LOCAL_201704031605.mass" }, "[email protected]" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')/FeatureOfInterest", "FeatureOfInterest" : { "@iot.id" : "c458a1a4-9810-11e8-8839-176a6dbe6951" }, "@iot.id" : "c45e9532-9810-11e8-8839-03e1e3365152", "@iot.selfLink" : "http://localhost:8080/FROST-Server/v1.0/Observations('c45e9532-9810-11e8-8839-03e1e3365152')" }
But the [email protected], Datastream .... are not the Important. But the Key must be the same.
Thats how it looks exactly (https://i.imgur.com/zvwf3g7.png)
Hole exported Stream:
Example Kafka Client :