How/Where to Process Subscribed Messages

I’m new to PAHO MQTT Client functions and subscribing to topics. From experience in Thonny it it appears to be an asynchronous environment with the processing done in the ‘on_message’ function.

I’m looking for best practices on what to do once a payload is read and processed. I’m going to have additional processing to do and I’m wondering if I should pass the payload off to a spawn program or writing to a monitored file.

Thanks

If your extra processing requires more than a small amount of time, it would be best to pass the message to another process/thread so that the on_message callback can return and hence allow the network loop to continue.

Apart from that, I would say that the specifics of how to do it really depends on what you’re happiest with.

Regards,

Roger