This topic describes the demo projects for Message Queue for MQTT and provides usage notes for using Message Queue for MQTT in various scenarios. For more information, see the comments of the source code of the demos.

Obtain demos for multiple programming languages

Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.java
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.java
Example on how to use the token-based authentication mode of Message Queue for MQTT mqtt.token.mode.demo.java
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.demo.java
Example on how to use Message Queue for MQTT to send messages and use Message Queue for Apache RocketMQ to subscribe to messages mqtt.to.rocketmq.demo.java
Example on how to use Message Queue for Apache RocketMQ to send messages and use Message Queue for MQTT to subscribe to messages rocketmq.to.mqtt.demo.java
Example on how to use Message Queue for MQTT to send ordered messages and use Message Queue for Apache RocketMQ to subscribe to ordered messages mqtt.ordered.msg.demo.java
Example on how to configure asynchronous status notifications for Message Queue for MQTT clients mqtt.client.status.notice.demo.java
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.python
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.python
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.mode.demo.python
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.php
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.php
Example on how to use the token-based authentication mode of Message Queue for MQTT mqtt.token.mode.demo.php
Example on how to use Message Queue for MQTT to send ordered messages and use Message Queue for Apache RocketMQ to subscribe to ordered messages mqtt.ordered.msg.demo.php
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.c
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.c
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.demo.c

Note: For more information about the dependency libraries for C, see eclipse/paho.mqtt.c.
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.net
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.net
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.mode.demo.net
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.javascript
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.javascript
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.demo.javascript
Example on how to use WebSocket to send and subscribe to messages mqtt.websocket.demo.javascript
Scenario Download URL
Example on how to use only Message Queue for MQTT to send and subscribe to messages mqtt.demo.ios
Example on how to use the signature authentication mode of Message Queue for MQTT mqtt.signature.mode.demo.ios
Example on how to use SSL encryption of Message Queue for MQTT mqtt.ssl.demo.ios

For the complete set of sample code, see mqtt-demo.

Decompress the downloaded package. The lmq-demo folder is added. Level-1 folders are classified based on programming languages. Perform debugging based on your business requirements.

Usage notes

If you use Message Queue for MQTT together with other backend message storage services, such as Message Queue for Apache RocketMQ, make sure that you understand the mappings between message structures and properties. For more information, see Message structure mappings between Message Queue for MQTT and Message Queue for Apache RocketMQ.

Note The integrity of a demo varies based on programming languages. Updates for demos will be provided in future versions. If a feature is unavailable in the demo, download the SDK for the corresponding programming language and then debug the feature. For more information, see Java examples.

References

The sample code is provided only for reference. For information about how to obtain the SDK for a specific programming language, see Download the SDK.