For the complete documentation index, see llms.txt. This page is also available as Markdown.

Adding an MQTT Publish Prefix

Configure a per-user topic prefix that Connectware adds to every MQTT message the user publishes.

A publish prefix is a fixed topic fragment that Connectware prepends to every MQTT message a user publishes. Because you set it per user, different users can route their data to different destinations without changing the topics they publish to.

For example, if UserA has the prefix topicA/ and publishes a message to some/values, Connectware delivers it on topicA/some/values.

Mapping resources can achieve the same routing, but each mapping adds an MQTT message transfer that a prefix avoids. This makes prefixes a good fit for high-throughput installations that need fast MQTT delivery.

Admin UI Configuration

To add an MQTT prefix to an existing user in the Admin UI, edit the MQTT Publish Prefix field in the Edit User dialog.

  1. Toggle the Advanced mode switch in the top right of the dialog. This extends the dialog with an Additional permissions section.

Advanced mode switch in the Edit User dialog
Edit User dialog in advanced mode
  1. Edit the MQTT Publish Prefix field.

MQTT Publish Prefix field
  1. In the Additional permissions section, add an MQTT write permission for each topic the user publishes to, including the prefix. For example, if the prefix is topicA/ and the user publishes to some/values, add write permission for topicA/some/values. To omit the prefix from the permission, use an MQTT wildcard as a placeholder, for example +/some/values.

Example

This example sets up and validates a publish prefix for the user newuser:

  1. Add the MQTT prefix route-to-downstream/ using the Edit User dialog as described above.

  2. Add an MQTT write permission for the topic route-to-downstream/my-topic (that is, including the prefix) for this user in the user management.

To confirm that the setting works as expected, send an MQTT message with an MQTT client, such as the mosquitto_sub and mosquitto_pub command-line tools. Install these tools before you continue.

  1. Subscribe to the topic route-to-downstream/my-topic with the following command:

Replace ${ADMIN_PASSWORD} with the password of the admin user.

  1. Publish a message to the topic my-topic with the following command:

Replace ${NEW_USER_PASSWORD} with the password of the newuser user.

The subscribed client receives the published message Hello World on the prefixed topic route-to-downstream/my-topic.

Last updated

Was this helpful?