Here is a Docker based example for Kafka using Go client
Overview
- Simple producer and consumer apps
- Confluent Go client for Kafka
- its based on librdkafka (Kafka C client)
- client setup part is taken care of with a pre-built Docker image – here is the Dockerfile
- I struggled with the Windows setup and chose the Docker route
- you can also opt to build your image and update the producer and consumer Dockerfile(s) to reference them
- Producer
- uses the traditional API for pushing messages to Kafka (channel is another option)
- receives notifications on the (default)
Events
(custom channel is another option or you can choose not to get notified)
- Consumer uses (
Events
) channel –Poll()
ing is another alternative - Docker Compose to bootstrap the sample app (producer and consumer) as a single unit
- BYOK (bring your own Kafka) for trying this out
- For Kafka on Docker – I recommend using Confluent Docker images or wurstmeister/kafka is also a great option
To run
Check out the README – it’s super easy to get going, thanks to Docker Compose!
References
Cheers!