Subscribe to Topics

Estimated reading time: 2 minutes

This page contains the following examples for subscribing to Topics in Flows:

Subscribe to One Topic

To create a flow that subscribes to a single topic:

  1. Go to DeviceHub > Tags. Click  to copy the RAW Topic of the tag that you want to subscribe to receive data from.

  2. Connect a DataHub Subscribe node to a Debug node.
  3. Double-click the DataHub Subscribe node. Enter the previously copied RAW Topic.

  4. Click Done. Click Save to start viewing the subscribed data output in the Debug tab at the bottom of the page.

Subscribe to All Topics

This example shows how to use a wildcard (>) to subscribe to all topics in DataHub.

Subscribing to all topics will potentially cause major slowdowns if you attempt to send the data to databases or clouds. If you plan to send the data to either, try flows like the examples below:

To create flow that subscribes to all topics:

  1. Use a DataHub Subscribe node. Connect it to a node for what you are trying to output to (debug for this example).
  2. Double-click the DataHub node and enter the > for the wildcard topic for subscribing to all topics.

  3. Click Done. Click Save to start viewing the data output from all Topics in the Debug tab at the bottom of the page.


Try these two options to improve performance and reduce the amount of data that we collect from the DataHub:

  1. devicehub.raw.> - This will send all data from DeviceHub tags only and no other sources of tags.
  2. devicehub.raw.{PLC_ID}.> - This will send all data from a specific PLC only.

Use Wildcards to Subscribe to Multiple Topics

In the Subscribe to All Topics flow, we used a Wildcard character to subscribe to all topics. Wildcards are useful for subscribing to multiple individual topics.Follow the steps described in Subscribe to One Topic, and replace the Topic name in step 3 using the following information about topic Wildcards:

> Wildcard Character: To subscribe to multiple topics, you can use the > character. You can use devicehub.raw.75B8BB04> to subscribe to the 3 topics in the above screenshot, for example. This allows you to receive the messages from multiple Tags.

* Wildcard Character: You can use the *** wildcard character in order to match a single token between. characters in tags. Thus, using devicehub.raw.*.* will match all topics that start with devicehub.raw and have two character sequences after each of the two **. characters.