1. Build Applications
  2. MQTT Clients

Build applications using MQTT

Note

This feature is currently in Public Preview.

Overview

Migrating foundational message queues can be a highly challenging task, requiring coordination among multiple teams and carrying significant risks. The migration process often involves inevitable modifications to code and data migration when transitioning to a new product. As Pulsar gains popularity, more and more users are drawn to its outstanding features. But the cost of migration presents a barrier to trying it out.

The MQTT protocol handler aka MoP solves this problem, providing MQTT protocol support for Pulsar and facilitating migrating to Pulsar from MQTT without code changes.

Compatibility

MoP is available on all StreamNative Clusters with the following specifications:

  • Pulsar version >= 3.0

You can determine if MoP is enabled on your cluster by checking the MQTT Service URL (TCP) on the Cluster Details page. Additionally, the MQTT clients will also be enabled if MoP is enabled.

mop-enabled

Feature Overview

MoP supports the vast majority of the MQTT protocol. For a more detailed breakdown, see the following:

VersionMQTTMoP
3.1YESYES
3.11YESYES
5.0YESYES

MQTT Client Page Wizard

To help you get started with setting up MQTT client libraries and tools after provisioning your cluster, StreamNative Console provides a step-by-step wizard to walk you through the basic setup and configuration process, such as selecting or creating service accounts, downloading key files or tokens, installing client libraries, generating sample codes to run, and so on.

To get started with the MQTT client setup wizard, follow these steps.

  1. On the left navigation pane of StreamNative Console, in the Admin section, click MQTT Clients.

  2. Follow the wizard to generate the sample code you need for connecting to your Pulsar cluster.

With a copy-and-paste, you can run the given sample code to produce and consume messages.

How MQTT Topics map to Pulsar Topics

For Apache Pulsar, The topic name consists of 4 parts:

<domain>://<tenant>/<namespace>/<local-name>

And / is not allowed in the local topic name. But for the MQTT topic name can have multiple levels such as:

/a/b/c/d/e/f

MoP mapping the MQTT topic name to Pulsar topic name as follows:

  1. If the MQTT topic name does not start with the topic domain, MoP treats the URL encoded MQTT topic name as the Pulsar local topic name, and the default tenant and default namespace will be used to map the Pulsar topic name.
  2. If the MQTT topic name starts with the topic domain, MoP will treat the first level topic name as the tenant and the second level topic name as the namespace and the remaining topic name levels will be covert as the local topic name with URL encoded.
Previous
Lenses