Kafka example in Go
I’ve known about Kafka for quite a time but have not found the time for experiment yet. In this post we will go over for how to interact with Kafka in Go.
There are three main requirements for configuring Kafka networking.
- Each Broker must be able to talk to Zookeeper — for leader election etc.
- Each Broker must be able to talk to every other Broker — for replication etc.
- Each Consumer/Producer must be able to talk to every Broker — for reading/writing data etc.
First we need to trigger up kafka using docker compose.
Trigger docker compose with
docker-compose -f docker-compose-expose.yml up
Client in Go
require github.com/segmentio/kafka-go v0.4.5
Running consumer will show this
Thanks for reading my post.