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 Delete Retained Messages Recursively Plugin.
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.
UPDATE: Kindly note, this plugin was supported by HiveMQ 3.X versions, however, not for HiveMQ 4.X versions. Contact us to get clarification if you are looking for this feature