This is an example on how to use Kafka Streamin API to aggregate logs and display results online in a dashboard.
- Java 8+
- Apache Kafka 0.11
- Apache Kafka Streams API
- Spring Boot
- STOMP
- Chart.js
-
Follow step 1 and step 2 of Kafka Quickstart
-
Create two topics: data-in and data-out
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic data-in
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic data-out
-
Clone and build java project
git clone https://github.com/sajmmon/kafka-streaming-websockets.git
cd kafka-streaming-websockets
mvn clean package
-
Run producer
java -cp target/shade-kafka-streaming-websockets-0.1.0.jar uk.ac.ebi.produce.KafkaExampleProducer
-
Run streaming client
java -cp target/shade-kafka-streaming-websockets-0.1.0.jar uk.ac.ebi.streaming.KafkaStreamingMain
-
Run spring boot
java -cp target/shade-kafka-streaming-websockets-0.1.0.jar uk.ac.ebi.Application
-
See live dashboard in localhost:8080
When you click "Connect" you should see: