A simple Kafka consumer example template using confluent-kafka.
| Name | Version |
|---|---|
| Python | 3.7 |
| pipenv(Python module) | 2018.11.26 or up |
- Initialize environment variable
cp sample.env .env
- Initialize Python environment
make init
- Enter the environment and start developing
pipenv shell
- Start kafka-consumer service
cd kafka/
python3 kafka/app.py
The service will start at 127.0.0.1:9092
This project uses black and isort for formatting
make reformat
This project uses pylint and flake8 for linting
make lint
This project uses pytest and its extension(pytest-cov) for testing
| Name | Version |
|---|---|
| Docker | 19.03.6 |
| docker-compose | 1.17.1 |
docker-compose build
This will build the image with tag kafka-consumer:latest
- Start containers
docker-compose up -d
- Enter kafka and create example messages
docker exec -it kafka bash
(In kafka container)kafka-producer-perf-test\
--topic example\
--throughput -1\
--num-records 1\
--record-size 1\
--producer-props bootstrap.servers=kafka:9092
- Darkborderman/Divik(reastw1234@gmail.com)