This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Message Queueing and Telemetry Transport
MQTT is a lightweight, broker-based publish/subscribe messaging protocol, which enables a publish/subscribe messaging model in an extremely lightweight way. WSO2 MB 3.0.0 fully supports MQTT version 3.1.0, and partially supports version 3.1.1.
The MQTT protocol allows a message to be sent to a topic based on three levels of QoS (Quality of Service) as explained below.
QoS 1 - At Most One - At this level, messages are delivered to subscribers in the most efficient manner. A message is dispatched only once.
QoS 2 - At Least One - At this level, the system will ensure that a message is received by the subscriber at least once. The level of delivery is assured through acknowledged delivery.
QoS 3 - Exactly Once - At this level, the message is delivered only once to its subscriber. This level is also defined as Assured Delivery
.
Enabling the transport
The <MB_HOME>/repository/conf/broker.xml
file contains parameters relating the the configuration of the MQTT transport. The transport can be enabled as shown in the following extract of the broker.xml
file.
<mqtt enabled="true"> <port>1883</port> <sslPort>8883</sslPort> <!-- put proper default ssl port --> <inboundBufferSize>32768</inboundBufferSize> <deliveryBufferSize>32768</deliveryBufferSize> <security> <authentication>OPTIONAL</authentication> <authenticator>org.wso2.carbon.andes.authentication.andes.CarbonBasedMQTTAuthenticator</authenticator> </security> </mqtt>
Related Parameters
Parameter Name | Description | Default Value |
---|---|---|
enabled | If the value for this parameter is true, the MQTT transport is enabled and the MQTT protocol will be applied to messages that are sent to the specified listening port. | true |
port | The listening port for the MQTT transport. The MQTT broker will be initialized with the specified port by default. This value would be incremented based on the offset specified in the carbon.xml. | 1883 |
sslPort | The listening SSL port for the MQTT transport. The MQTT secure socket will be initialized with the specified port by default. | 8883 |
Refer the description of the broker.xml file for further details.