In MQTT, messages with QoS 1 or 2 must be delivered at least once (QoS 2 messages must be delivered exactly once). If the client is not connected, the broker must store the message until the client is ready to receive it.

The HiveMQ blog has an interesting point:

But what happens if a client does not come online for a long time? The constraint for storing messages is often the memory limit of the operating system. There is no standard way on what to do in this scenario. It totally depends on the use case. In HiveMQ we will provide a possibility to manipulate queued message and purge them.

Since this seems to be dependent on the broker, how does Mosquitto handle this situation? Does it just crash after running out of memory or are old messages finally purged?


Messages are persisted to disk not just held in memory.

Look at the autosave_interval and autosave_on_change options for when the messages get written to disk.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.