This documentation is for WSO2 Enterprise Service Bus version 5.0.0. For the latest ESB, view the latest WSO2 Enterprise Integrator documentation.

All docs This doc
Skip to end of metadata
Go to start of metadata

MQ Telemetry Transport (MQTT) is a simple and lightweight network protocol for device communication. This is an easy to implement protocol that is based on the principle of publish/subscribe. These characteristics make MQTT ideal for use in constrained environments.

For example,

  • When the network is expensive, has low bandwidth or is unreliable.
  • When running on an embedded device with limited processor or memory resources.

The MQTT transport implementation requires an MQTT server instance to be able to send and receive messages. The recommended MQTT server is the Mosquitto message broker. 

Configuration parameters for the MQTT receiver and sender are XML fragments that represent MQTT connection factories.

Following is a sample MQTT connection factory configuration that consists of four connection factory parameters:

<parameter locked="false" name="mqttConFactory">
                <parameter locked="false" name="">localhost</parameter>
                <parameter locked="false" name="mqtt.server.port">1883</parameter>
                <parameter locked="false" name="">esb.test.listener</parameter>
                <parameter locked="false" name="">esb.test2</parameter>

MQTT connection factory parameters

Following are details on the MQTT parameters that you can set:

Parameter Name



Possible Values name of the host.


A valid host name

mqtt.server.portThe port ID.Yes1883,1885
mqtt.client.idThe client ID.YesA valid client ID
mqtt.topic.nameThe name of the topicYesA valid topic name
mqtt.subscription.qosThe QoS value.No


mqtt.session.cleanWhether session clean should be enabled or not.Notrue, false
mqtt.ssl.enableWhether ssl should be enabled or not.Notrue , false
mqtt.subscription.usernameThe username for the subscription.NoA valid user name
mqtt.subscription.passwordThe password for the subscription.NoA valid password path of the directory to be used as the persistent data store for quality of service purposes.NoA valid local path. The default value is the ESB temp path.
mqtt.blocking.senderWhether blocking sender should be enabled or not.Notrue , false
mqtt.content.typeThe content type.NoA valid content type. the default content type is text/plain.
mqtt.message.retainedWhether the messaging engine should retain a published message or not. This parameter can be used only in the transport sender.Notrue, false
The default value is false.

For a sample that demonstrates how Axis2 publishes a message on a particular topic, and how an MQTT client subscribed to that topic receives it, see  Sample 272:Publishing and Subscribing using WSO2 ESB's MQ Telemetry Transport.

  • No labels