Closed sahilpaudel closed 3 years ago
Hi @sahilpaudel,
worker.start
is a blocking function. Problem is below:
if __name__ == '__main__':
start_worker("my_topic") # This blocks the code execution
app.run(debug=True, use_reloader=False) # This will not run
You should be running the workers in different processes and managing them separately from the flask app.
As for the gibberish message in the topic, this is normal as you are seeing the serialized form of the python function add
.
Hi @joowani Any suggestions how to go about that. It would be great ig you could help me with that.
Thanks.
HI @sahilpaudel,
There is not much more to it other than running worker.py separately. Preferably with a service manager like systemd.
Thanks @joowani We want to use kq in our live project that handles request in millions everyday. So we want to take suggestion from you if we can use it in production.
Hi @sahilpaudel,
kq is just a very light wrapper that sits on top of kafka-python library, which I do think is well-maintained and production ready. If your team is already well-versed in Python and Kafka (and kafka-python), then I would say it's worth trying out for POCs.
Closing due to inactivity. Please feel free to reopen if you have any other questions. Thanks.
System OS: macOS Catalina 10.15.6 Kafka : stable 2.6.0 zookeeper: stable 3.6.1
I am trying to using kq with my flask application and below is the code for the same. When the application starts the worker also starts with a topic provided. And when I hit an api
/status
it should execute a functionadd
which is not happening here andprint("add executed")
is never called.Also
kafka-console-consumer --bootstrap-server localhost:9092 --topic my_topic
gives some gibberish output when I hit the apimain.py
worker_app.py
queue.py