Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.41 KB

README.md

File metadata and controls

52 lines (38 loc) · 1.41 KB

Kafka Streams Aggregator

Code Structure

├── src
│   └── main
│       └── java
│           └── com
│               └── kevinsimard
│                   └── kafka
│                       └── streams
│                           └── Application.java
├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE.md
├── README.md
└── pom.xml

Usage

Create Kafka topics with the following commands.

$ kafka-topics --zookeeper localhost --create --partitions 1 --replication-factor 1 --topic sales-raw
$ kafka-topics --zookeeper localhost --create --partitions 1 --replication-factor 1 --topic sales-aggregated

Run mvn compile exec:java to run the application.

Use the Kafka console producer tool to test the application.

$ kafka-console-producer --broker-list localhost:9092 --topic sales-raw

Enter the following message to start aggregating numbers.

# Format: {"user_id":<int>,"sale_id":<int>,"total":<double>}
{"user_id":1,"sale_id":1,"total":100.00}

Use the Kafka console consumer tool to view aggregated messages.

$ kafka-console-consumer --bootstrap-server localhost:9092 --from-beginning --topic sales-aggregated

License

This package is open-sourced software licensed under the MIT license.