How to auto detect list of Topics from Dynamic MQTT subscription


I am trying to use Dynamic Subscription on MQTT to read all the available published Topics from a MQTT broker. The reason is we don't know all the published Topic beforehand and need an automatic discovery method to retrieve the full Topic listing.

I am testing using the Aedes MQTT Broker module loaded on the same PC and the default MQTT read client node. 2 test injection with different Topic label are pushed to the Aedes MQTT.

Connecting a direct MQTT read is working as expected when known Topic is entered in the setting.

However, nothing return when trying to connect using Dynamic Topic Subscription method. Below is the flow setup:

[{"id":"9d752516c0511ccf","type":"mqtt in","z":"6265e7c68514376d","name":"","topic":"","qos":"2","datatype":"utf8","broker":"ec674c1c.f707b","nl":false,"rap":true,"rh":0,"inputs":1,"x":310,"y":520,"wires":[["fc4eac98f644f279"]]},{"id":"ec674c1c.f707b","type":"mqtt-broker","name":"nipi","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

I have tried installing different MQTT client with Dynamic subscription but none seems to work.

Any advise is greatly appreciated.

Best Regards,

To subscribe to all topics use #.

To learn all about MQTT then see this tutorial MQTT Essentials - All Core Concepts explained

This is not what dynamic subscriptions is about.

The dynamic aspect of MQTT nodes is the ability to connect to a broker, disconnect from a broker and subscribe to topic(s) at runtime, programmatically.

What you are asking for doesn't really exist in MQTT. You can't simply ask a broker for a topic listing since all topics are created by external clients that the broker has no fore knowledge of.

About the best you can achieve its subscribe to # and wait until you believe you have captured everything.

1 Like

Note. Not all brokers allow you to do a subscribe to a top level #


Indeed. Unless configured to do so, I know emqx broker doesn't permit subscribing to # by default

Hi Colin and Steve and Dceejay, thanks for the clarification.

The # as Topic subscription worked.

Best Regards,

Presumably MQTT Explorer would not work if # were not supported.


If I remember rightly, you can subscribe to # but you get no topics.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.