I have Flask application running to serve the API endpoint, in the same application I have to implement also kafka consumer in order to consume events from kafka stream, but because of the kafka consumer should run forever, I am using python threads to run the kafka consumer in the background, I have some questions please
- is using threading ok? and What is the best practice to run Kafka consumer with flask app in general ?
- If using threading is ok, how to force the flask app to stop if the kafka consumer thread stops for any reason ?