Contact Us 1-800-596-4880

MQTT Connector 1.0

Anypoint Connector for MQTT (MQTT Connector) is an MQTT (Message Queuing Telemetry Transport) v3.x protocol-compliant MuleSoft extension. MQTT is a lightweight publish/subscribe messaging protocol designed for connecting remote devices with a small code footprint and minimal network bandwidth. MQTT today is used in a wide variety of industries, such as automotive, manufacturing, telecommunications, and oil and gas.

The connector supports capabilities specified in MQTT v3.x protocol, including but not limited to reliable message delivery, persistent sessions, support for unreliable and low bandwidth networks, message retention, and last will and testament (LWT) messages. The connector supports TLS to securely connect and communicate with a MQTT broker.

For compatibility information and fixed issues, see the MQTT Connector Release Notes.

Before You Begin

To use this connector, you must be familiar with:

  • MQTT v3.x protocol

  • Anypoint Connectors

  • Mule runtime engine (Mule)

  • Elements and global elements in a Mule flow

  • Creating a Mule app using Anypoint Studio (Studio)

Before creating an app, you must have Anypoint Platform and Anypoint Studio.

Common Use Cases for the Connector

These are some common use cases for MQTT Connector based on MQTT version3.x protocol:

  • Connect to MQTT brokers by specifying a failover server list that the client iterates over until a connection is successfully established.

  • Connect to MQTT brokers in a reliable messaging schema and publish messages.

  • Connect to an MQTT broker and set a last will and testament (LWT) message to notify all the subscribers of the client’s disconnection.

  • Connect to an MQTT broker with Transport Layer Security (TLS) and listen for messages.

  • Listen for messages in a single or multiple topics.

  • Listen for messages on multiple topics using single-level or multi-level wildcards.

  • Publish messages to a topic.

  • Publish messages with retention.

  • Publish messages to an MQTT topic and set different Quality of Service (QoS) levels of delivery assurance for inbound or outbound messages.

MQTT Architecture

MQTT uses the publish/subscribe model, in which a client publishes messages to a particular address, known as a Topic. Client receivers subscribe to the topic and receive the published message. In this model, neither the publisher nor the subscriber is aware of each other. The connection between the publisher and subscriber is managed by an MQTT broker.

MQTT Client

A MQTT Client is any device that runs an MQTT library and connects to an MQTT server over a network.

MQTT Broker

The MQTT Broker is a server that receives messages from the clients and then routes the messages to the appropriate destination clients.

MQTT Topic

As the broker acts as a post office, MQTT doesn’t use the address of the intended recipient but uses the subject line called Topic, and anyone who wants a copy of that message subscribes to that topic. Multiple clients can receive the message from a single broker (one to many).

Next Step

After you complete the prerequisites, you are ready to create your own app and configure the connector using Anypoint Studio.

View on GitHub