What is the advantage of using MQTT to write to database VS direct method

Our database is located on a different facility from our data source (sensor).
But they belong to the same IP Network via VPN.

We want to understand what is the advantage of using MQTT for writing the data from sensor to database?

Instead of directly writing the data to database using direct method?

Thank you.

Hi @liaobp1983,

your question broaches a very broad subject. One point would be that MQTT allows an asynchronous two way communication, so information can be pushed back to the sensor. An other would be that the message guarantees of MQTT are very clearly defined, where as a direct write to the DB is very implementation dependent.

As further reading I can recommend the articles listed on this page https://www.hivemq.com/mqtt-essentials/.

Have a nice day

Georg

This says a lot. But I wonder how the implementation of banks or chat services or social media looks like.
How they guarantee messages are sent and received. what if someone pull the blue cable, as soon as someone sent a message. This, I always wonder.