Kafka

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.

Photo by Carolyn V on Unsplash

Kafka requirements

There are three main requirements for configuring Kafka networking.

  1. Each Broker must be able to talk to Zookeeper — for leader election etc.
  2. Each Broker must be able to talk to every other Broker — for replication etc.
  3. Each Consumer/Producer must be able to talk to every Broker — for reading/writing data etc.
Kafka communication

First we need to trigger up kafka using docker compose.

docker-compose.yml

docker-compose-expose.yml

Trigger docker compose with

docker-compose -f docker-compose-expose.yml up