A small project to play around with Kafka and Go, consisting of a producer module and a consumer module. Everything is dockerized and can be run with docker-compose.
The events being sent into Kafka are fake "purchase" events, they include a unique uuid, buyer's name, item and price. They are serialized to json before being sent.
Below are the logs of two docker containers, showing the producer sending events and the consumer receiving them.
Top - Consumer, Bottom - Producer
go-kafka-experiment.mp4
There are three modules in this project:
producer- sends events to Kafkaconsumer- receives events from Kafkautil- contains shared utility code
Each one has a seperate Dockerfile, except for util. The expected way to run them is with docker-compose, as it contains the build context.
-
Run
docker-compose up -
Rerun
consumerorproduceras appropriate, usingdocker-compose run --build <consumer|producer>