Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 705 Bytes

kafka.md

File metadata and controls

37 lines (27 loc) · 705 Bytes

Kafka CLI

Kafka cli

alias ka="docker exec kafka-event-stream_kafka_1"
alias kait="docker exec -it kafka-event-stream_kafka_1"

Create topic

ka kafka-topics.sh --create --topic my-topic --bootstrap-server localhost:9092

Get list of topics

ka kafka-topics.sh --list --bootstrap-server localhost:9092
ka kafka-topics.sh --describe --topic my-topic --bootstrap-server localhost:9092

Producer

kait kafka-console-producer.sh --topic my-topic --bootstrap-server localhost:9092

Then write your message

> salam

Consumer

ka kafka-console-consumer.sh --topic my-topic --from-beginning --bootstrap-server localhost:9092