modified README.md
parent
1baffafb74
commit
0eb84c899b
51
README.md
51
README.md
|
|
@ -1 +1,52 @@
|
||||||
# kafka-demo
|
# kafka-demo
|
||||||
|
This project is just a sample demonstration inspired by question "How do
|
||||||
|
we monitor a kafka stream with a OneAgent and see the data on Dynatrace?"
|
||||||
|
|
||||||
|
# setup
|
||||||
|
You need to [download](https://kafka.apache.org/downloads) kafka on your
|
||||||
|
device. For this demo project the binary Scala 2.12 - kafka_2.12-3.5.1.tgz
|
||||||
|
was downloaded, therefore kafka version 3.5.1 is used.
|
||||||
|
|
||||||
|
# run
|
||||||
|
First you have to start and run the zookeeper server, afterwards the kafka server
|
||||||
|
and finally the consumers.
|
||||||
|
```sh
|
||||||
|
bin/zookeeper-server-start.sh config/zookeeper.properties
|
||||||
|
bin/kafka-server-start.sh config/server.properties
|
||||||
|
bin/kafka-console-consumer.sh --topic TOPIC_INSTANCE --from-beginning --bootstrap-server localhost:9092
|
||||||
|
bin/kafka-console-consumer.sh --topic TOPIC_INSTANCE_JSON --from-beginning --bootstrap-server localhost:9092
|
||||||
|
```
|
||||||
|
`NOTE: MAKE SURE YOU FOLLOW THE ORDER!`
|
||||||
|
|
||||||
|
Run this project by starting the KafkaDemoApplication!
|
||||||
|
|
||||||
|
# demo
|
||||||
|
Once everything is running open the following link in your browser:
|
||||||
|
http://localhost:8080/api/v1/kafka/publish
|
||||||
|
|
||||||
|
If you want to produce a message then you can add the message query parameter and
|
||||||
|
your value as following:
|
||||||
|
http://localhost:8080/api/v1/kafka/publish?message=Madrid
|
||||||
|
http://localhost:8080/api/v1/kafka/publish?message=London
|
||||||
|
http://localhost:8080/api/v1/kafka/publish?=Vienna
|
||||||
|
http://localhost:8080/api/v1/kafka/publish?=Pizza
|
||||||
|
|
||||||
|
On one of the consumers you will see the messages!
|
||||||
|
|
||||||
|
It is possible to send a JSON Object. To do that you will have to send a POST
|
||||||
|
request via e.g. Postman. In Postman choose the POST method and use this link:
|
||||||
|
http://localhost:8080/api/v1/kafka/publish
|
||||||
|
|
||||||
|
Afterward under Body, pick raw and instead Text pick JSON. In the body section
|
||||||
|
you can add the following object:
|
||||||
|
```JSON
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"vin": "V09JHY4",
|
||||||
|
"location": "New York"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Send.
|
||||||
|
|
||||||
|
You should be able to see the data in one of the consumers! If you encounter
|
||||||
|
any warnings after starting the consumers you can ignore them!
|
||||||
Loading…
Reference in New Issue