Simple Secured Restful Service [Written in FlaskRestful ,kafka-python, flask_jwt] Writes/Reads JSON messages to/from Kafka Broker Hosted on local Docker Containers (kafka broker with ZooKeeper) This would be helpful , for Dev & Test projects.
- Docker /Docker Compose is available
- Python 2.7>
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
git clone git@github.com:madhushesharam/messageSimulator-kafka.git
cd messageSimulator-kafka
pip install -r requirements.txt
docker-compose -f docker-compose.yml up
python app.py
Auth Retreive Token
curl -X POST http://127.0.0.1:5000/auth -d ' {"username" : "user1","password" : "abcxyz"}'
Post Messages
curl -X POST http://127.0.0.1:5000/messages -H 'authorization: JWT $TOKEN -d '{"key1": "val1","Key2": "val2"}'
Read latest single event from Kafka
curl -X GET http://localhost:5000/messages -H 'authorization: JWT $TOKEN
- Parametrize the PORT,HOST etc
- simplify installation requirements.txt / make File
- Parametrize the PORT,HOST / create CONFIG utils
- simplify installation requirements.txt / make File
- Refactor & Additional Error Handling
- Add Tests & CICD
- Port AUTH to noSQL DB
- kafka-python - Python lib
- Flask-Restful - The web framework used
- Docker
- Madhu Shesharam - Initial work
https://kafka-python.readthedocs.io https://flask-restful.readthedocs.io https://pythonhosted.org/Flask-JWT/ https://github.com/simplesteph/kafka-stack-docker-compose