I am writing a web app to log MQTT Data in a database after processing then a dashboard will query the database and visualize the data.
I am using a python script, which runs all time with Paho MQTT Client to process and store MQTT data in a database.
I think there should be a better and scalable way to process MQTT payloads. Can anyone suggest a better way?
I ever have the same doubt before, but I think you are doing the right way.
If we think further of MQTT nature, there is no traditional "server side" in MQTT context. Most probably, people treat "broker" as server side, but it is totally different, broker in MQTT core concept shall be content-agnostic and thus shall not handle messages directly.
Of course, you can always bundle an internal subscriber for data handling features with the broker and make it looks like one complete "server" solution, like some commercial MQTT brokers do. But conceptually, it is still handled by a subscriber and not much different from your proposed way.