Skip to content

Kafka Demo using Java with multiple data Serialization (Protobuf, JSON, Avro etc)

Notifications You must be signed in to change notification settings

telkomdev/KafkaDemoJava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka Demo With Java

Run Kafka

$ docker-compose up

Show Kafka Topic list

$ ./opt/kafka/bin/kafka-topics.sh --list --zookeeper zookeeper:2181

Create Kafka Topic with name demo

$ ./opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 100 --topic demo

Show Kafka Topic information from topic demo

$ ./opt/kafka/bin/kafka-topics.sh --describe --topic demo --zookeeper zookeeper:2181

Run Producer

$ cd Producer

Build

$ mvn clean package

Send message to broker

$ BROKERS=localhost:9092 TOPIC=demo java -jar target/Producer-1.0-SNAPSHOT.jar
$ Type Message (type 'exit' to quit)
$ hello

Run Consumer

$ cd Consumer

Build

$ mvn clean package

Receive message from broker

$ BROKERS=localhost:9092 TOPIC=demo java -jar target/Consumer-1.0-SNAPSHOT.jar
$ Record Key null
$ Record value Product{id='001', name='Nokia 6', quantity=5, images=[wuriyanto.com/img1, wuriyanto.com/img2]}
$ Record partition 49
$ Record offset 0

About

Kafka Demo using Java with multiple data Serialization (Protobuf, JSON, Avro etc)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published