Skip to content

Latest commit

 

History

History

data_export_kafka

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

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.

  1. Start a kafka server by running:
docker-compose -f examples/data_export_kafka/docker-compose.yml up
  1. 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
  1. Update dependencies:
make vendor
  1. 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.

  1. 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