Commit 5e5cb092 authored by Shanelle Valencia's avatar Shanelle Valencia

[AFP-53] 📝 Add readme instructions to test kafka producer and consumer [@svalencia]

parent 280f1270
Pipeline #1682 canceled with stage
...@@ -62,20 +62,34 @@ Example Console Response: ...@@ -62,20 +62,34 @@ Example Console Response:
## Testing Kafka Producer and Consumer ## Testing Kafka Producer and Consumer
Make sure kafka server and zookeeper are running Make sure kafka server and zookeeper are running
To create a kafka topic: To create a kafka topic:
```
kafka-topics.sh --describe --topic <insert-topic-here> --bootstrap-server localhost:9092 kafka-topics.sh --describe --topic <insert-topic-here> --bootstrap-server localhost:9092
```
if the above command doesn't work, try: if the above command doesn't work, try:
```
/usr/local/Cellar/kafka/2.8.0/bin/kafka-topics --describe --topic orders --bootstrap-server localhost:9092 /usr/local/Cellar/kafka/2.8.0/bin/kafka-topics --describe --topic orders --bootstrap-server localhost:9092
```
To start kafka console for producer: To start kafka console for producer:
```
kafka-console-producer.sh --topic orders --bootstrap-server localhost:9092 kafka-console-producer.sh --topic orders --bootstrap-server localhost:9092
```
-OR- -OR-
```
/usr/local/Cellar/kafka/2.8.0/bin/kafka-console-producer --topic orders --bootstrap-server localhost:9092 /usr/local/Cellar/kafka/2.8.0/bin/kafka-console-producer --topic orders --bootstrap-server localhost:9092
```
To start kafka console for consumer: To start kafka console for consumer:
```
kafka-console-consumer.sh --topic orders --from-beginning --bootstrap-server localhost:9092 kafka-console-consumer.sh --topic orders --from-beginning --bootstrap-server localhost:9092
```
-OR- -OR-
```
/usr/local/Cellar/kafka/2.8.0/bin/kafka-console-consumer --topic orders --from-beginning --bootstrap-server localhost:9092 (--from-beginning flag will show all messages that were received for this particular topic) /usr/local/Cellar/kafka/2.8.0/bin/kafka-console-consumer --topic orders --from-beginning --bootstrap-server localhost:9092 (--from-beginning flag will show all messages that were received for this particular topic)
```
if you're still getting errors finding the pathway for kafka, try running: if you're still getting errors finding the pathway for kafka, try running:
ls -alrth /usr/local/Cellar/kafka/ ```
ls -alrth /usr/local/Cellar/kafka/
```
then find your way to the bin directory where you'll find all the kafka commands then find your way to the bin directory where you'll find all the kafka commands
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment