Kafka exporter example
This example contains everything you need to export the usage of your flag to AWS Kinesis
.
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_kinesis/docker-compose.yml up
- Create python virtualenv & Install awslocal
mkvirtualenv go-features-flag-kinesis
# or activate existent
workon go-features-flag-kinesis
pip install awscli awscli-local
- Create a topic in Kinesis:
awslocal kinesis create-stream --stream-name test-stream --region us-east-1
- Update dependencies:
make vendor
- Run the example application:
go run ./examples/data_export_kinesis/main.go
If you check the logs, you should see the events being sent 1 by 1 to kinesis.
- Read the items in the topic:
SHARD_ITERATOR=$(awslocal kinesis get-shard-iterator --shard-id shardId-000000000000 --shard-iterator-type TRIM_HORIZON --stream-name test-stream --query 'ShardIterator' --region us-east-1)
awslocal kinesis get-records --shard-iterator $SHARD_ITERATOR --region us-east-1