Kafka exporter example
This example contains everything you need to export the usage of your flag to Kafka
.
How to setup the example
All commands should be run in the root level of the repository.
- Start a kafka server by running:
docker-compose -f examples/data_export_kafka/docker-compose.yml up
- Create a topic in Kafka:
docker exec $(docker ps | grep cp-kafka | awk '{print $1}') kafka-topics --create --topic go-feature-flag-events --bootstrap-server localhost:9092
- Update dependencies:
make vendor
- Run the example application:
go run ./examples/data_export_kafka/main.go
If you check the logs, you should see the events being sent 1 by 1 to kafka.
- Read the items in the topic:
docker exec $(docker ps | grep cp-kafka | awk '{print $1}') kafka-console-consumer --bootstrap-server localhost:9092 --topic go-feature-flag-events --from-beginning