Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/telkomdev/kafkademojava
Kafka Demo using Java with multiple data Serialization (Protobuf, JSON, Avro etc)
https://github.com/telkomdev/kafkademojava
java kafka kafka-consumer kafka-java kafka-producer spring-boot
Last synced: about 5 hours ago
JSON representation
Kafka Demo using Java with multiple data Serialization (Protobuf, JSON, Avro etc)
- Host: GitHub
- URL: https://github.com/telkomdev/kafkademojava
- Owner: telkomdev
- Created: 2019-10-08T14:41:18.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-04T23:55:23.000Z (about 2 years ago)
- Last Synced: 2023-03-04T15:52:53.628Z (over 1 year ago)
- Topics: java, kafka, kafka-consumer, kafka-java, kafka-producer, spring-boot
- Language: Java
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Kafka Demo With Java
### Run Kafka
```shell
$ docker-compose up
```Show Kafka `Topic` list
```shell
$ ./opt/kafka/bin/kafka-topics.sh --list --zookeeper zookeeper:2181
```Create Kafka `Topic` with name `demo`
```shell
$ ./opt/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 100 --topic demo
```Show Kafka `Topic` information from topic `demo`
```shell
$ ./opt/kafka/bin/kafka-topics.sh --describe --topic demo --zookeeper zookeeper:2181
```### Run Producer
```shell
$ cd Producer
```Build
```shell
$ mvn clean package
```Send message to broker
```shell
$ BROKERS=localhost:9092 TOPIC=demo java -jar target/Producer-1.0-SNAPSHOT.jar
$ Type Message (type 'exit' to quit)
$ hello
```### Run Consumer
```shell
$ cd Consumer
```Build
```shell
$ mvn clean package
```Receive message from broker
```shell
$ 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
```