Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 2.65 KB

Readme.md

File metadata and controls

59 lines (38 loc) · 2.65 KB

Kafka Temperature Analytics

Alternate approach to Kstreams using flink. The temperature status is calculated using predefined values. The key and value of the kafka is consumed and produced using custom serde.

CodeQL Java CI with Maven License GitHub top language

Architecture:

Architecture

Prerequisite

  1. Java 17
  2. Docker
  3. Confluent Kafka 6.2.0
  4. Maven
  5. Flink

Getting Started

To run the application, Build the maven project

mvn clean install  

Run the project

Submit the application to the flink cluster. The docker file with embedded flink cluster and kafka broker is provided in resources/docker. It can be started via

docker-compose up -d

Create dummy data by Datagen or by console producer as below

kafka-console-producer.bat --bootstrap-server localhost:9092 --topic flink_source --property "parse.key=true" --property "key.separator=|"
{"serial" : "1"}|{"serial":"1","owner":"appu","temp":"25","location":"earth"}  //normal
{"serial" : "1"}|{"serial":"1","owner":"appu","temp":"66","location":"earth"}  //hot
{"serial" : "1"}|{"serial":"1","owner":"appu","temp":"-4","location":"earth"} //cold
{"serial" : "1"}|{"serial":"1","owner":"appu","temp":"99","location":"earth"} //invalid

The output can be observed by consuming the destination topic

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic flink_destination --property print.key=true

Alternatives

KafkaTemperatureAnalytics | KafkaTemperatureAnalyticsSpark