Skip to content

How to Delete MQTT Retained Messages on Subtopics Recursively

by HiveMQ Team
2 min read

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

HiveMQ Team

Team HiveMQ shares deep expertise in MQTT, Industrial AI, IoT data streaming, Unified Namespace (UNS), and Industrial IoT protocols. Our blogs explore real-world challenges, practical deployment guidance, and best practices for building modern, reliable, and a secure data backbone on the HiveMQ platform, along with thought leadership shaping the future of the connected world.

We’re on a mission to build the Industrial AI Platform that transforms industrial data into real-time intelligence, actionable insights, and measurable business outcomes.

Our experts are here to support your journey. Have questions? We’re happy to help. Contact us.

Related content:

HiveMQ logo
Review HiveMQ on G2