
How to delete MQTT Retained Messages on Subtopics Recursively
By default, every MQTT topic can have a retained message. The standard MQTT mechanism to clean up retained messages is sending a retained message with an empty payload to a topic. This will remove the retained message.
However, sometimes you just want to delete all retained messages for a topic tree, recursively. This is now possible with the brand new Delete Retained Messages Recursively Plugin. You can download the plugin here.
Retained Message Store Service API
Even if this plugin itself isn’t useful for you, this is a perfect starting point for studying the Retained Message Store Service API for your own plugins. With HiveMQ it’s a piece of cake to add, delete and modify the retained messages on topics. If you want to take a look at the source code, the code is available on Github.
About HiveMQ Team
We love writing about MQTT, IoT protocols and architecture in general. Our experts are here to help, so reach out to us if we can help!
Getting started: HiveMQ, Native Websockets Support and Message Log Plugin