issue CELERY and mqtt
Yes I can confirm that mqtt publish does not works on celery beat.
@shared_task
def time_sched():
print("send.....")
res = mqtt.client.publish('clients/c/0000000016ab8294', json.dumps({"celery":"ok"}), qos=2)
res.wait_for_publish()
@celery.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
sender.add_periodic_task(5.0, time_sched.s())
this task will halt forever.
if we will use without res.wait_for_publish(), you will see that is published in logger but nothing came in to channel.
but when I run it without celery just like:
@manager.command
def mqtt_test():
while True:
sleep(1)
res = mqtt.client.publish('clients/c/0000000016ab8294', json.dumps({"celery":"ok"}), qos=2)
res.wait_for_publish()
No issues here
this is also related current issue: https://stackoverflow.com/questions/55864502/mqtt-message-not-getting-published-from-celery-beat-task
any news? have the same problem
Hello,
I experience the same issue and this bug is open for 4 years now. What is the status?
Yours sincerely,
Quirin
Unfortunately without additional information it's difficult to investigate; it would be useful if someone could provide an example (e.g. docker-compose with everything necessary to duplicate the issue) or full code (showing how the connection is established) and logs (the easier you can make it for us to replicate/track the issue the more likely it is that we will be able to resolve it).
I'm going to close this due to lack of activity/reproducability. Please feel free to reopen if you are able to provide a way for us to duplicate the issue (or debug logs etc).