clive-jevons / mqtt-elasticsearch-forwarding

Example projects demonstrating how to forward incoming MQTT payloads to an ElasticSearch instance in various languages.
Apache License 2.0
3 stars 2 forks source link

Python code stops forwarding messages #1

Open PrashantPathakDB opened 6 years ago

PrashantPathakDB commented 6 years ago

I am using the Python code to forward the MQTT messages to ES server. Some time the code stop forwarding and stays in while: True loop inside class App. When I checked for MQTT messages by subscribing from other terminal, it shows the incoming messages. It recovers only when I restart the code.

clive-jevons commented 6 years ago

Hi @pathakhcst ,

The Paho Python client claims to provide automatic reconnect functionality, but I haven't actually tested this.

You could try adding an on_disconnect callback to the MqttClient to see if this is the reason for the client to stop receiving updates. See https://www.eclipse.org/paho/clients/python/docs/ under 'on_disconnect()'.

If you see that the client is disconnecting due to some error but not reconnecting, I suggest raising an issue with the Paho Python client project.

Cheers, C