This topic describes the concepts and terms of Message Queue for MQTT and the Message Queuing Telemetry Transport (MQTT) protocol.
An entity of the Message Queue for MQTT service that you create and purchase. Each Message Queue for MQTT instance has a globally unique endpoint URL. Before you use Message Queue for MQTT, you must create an instance in the corresponding region and access the service by using the endpoint of the instance. For more information about how to create a Message Queue for MQTT instance, see Quick Start.
- Message ID
- A globally unique identifier for a message. Message IDs are automatically generated by the Message Queue for MQTT system. Message IDs are used to track messages and troubleshoot problems. For more information, see Message tracing.
- Message Queue for MQTT broker
- A broker provided by Message Queue for MQTT for MQTT-based interactions. This broker is responsible for messaging between a Message Queue for MQTT client and Message Queue for Apache RocketMQ.
- Message Queue for MQTT client
- A mobile node that interacts with the Message Queue for MQTT broker.
- P2P message
- A special type of message provided by Message Queue for MQTT based on the standard MQTT protocol. This type of message can be directly sent to a Message Queue for MQTT client without going through regular subscriptions. For more information, see P2P messaging model.
- Parent topic
- The MQTT protocol is a messaging protocol based on the publish/subscribe model. Therefore, each message belongs to a topic. The MQTT protocol supports multiple levels of topics. A level-1 topic is a parent topic. Before you use Message Queue for MQTT, you must create a parent topic in the Message Queue for MQTT console or the Message Queue for Apache RocketMQ console.
- A level-2 or level-3 topic is a subtopic of a parent topic in Message Queue for MQTT. You can directly set subtopics in the code without the need to create them in the console. The total length of a parent topic and its subtopics cannot exceed 64 characters in Message Queue for MQTT. Otherwise, a client exception may occur.
- Client ID
A client identifier that is globally unique in Message Queue for MQTT. If a client uses the same client ID as a connected client to access the Message Queue for MQTT service, the access request will be denied.
A client ID consists of two parts in the format of <GroupID>@@@<DeviceID>. A client ID cannot exceed 64 characters in length and cannot contain non-printable characters. For more information, see Limits.
- Group ID
- An identifier that specifies a group of nodes with identical logic and features. A group ID represents a set of devices that have the same features. A group ID must be created in the Message Queue for MQTT console. For more information about how to create a group ID, see Quick Start.
- Device ID
- A unique identifier for each device that you specify. Device IDs must be globally unique. For example, you can use the serial number of a sensor device as its device ID.
- Rules are the resources that implement data exchanges between Message Queue for MQTT V3.x.x and other Alibaba Cloud services. You can specify the following types of rules
in Message Queue for MQTT:
- Data inbound rule: You can configure a data inbound rule to read data from a specified Alibaba Cloud service and push the data to a Message Queue for MQTT client over the MQTT protocol. This way, you can directly call the API of the Alibaba Cloud service to send data to the Message Queue for MQTT client. For more information, see Redirect inbound data from other cloud services.
- Data outbound rule: You can configure a data outbound rule to export messages from a Message Queue for MQTT client to another Alibaba Cloud service. This way, you can directly call the API of the Alibaba Cloud service to read messages sent from the Message Queue for MQTT client. For more information, see Redirect outbound data to other cloud services.
- Rule for client status notification: You can configure a rule for client status notification to export the status event data of a Message Queue for MQTT client to other Alibaba Cloud services. For more information, see Retrieve the online status of the client.
Message Queue for MQTT provides both public and internal endpoints. We recommend that you use public endpoints for mobile devices. In addition to standard MQTT port 1883, Message Queue for MQTT also supports SSL encryption, WebSocket, and Flash. The endpoint URL is automatically allocated after an instance is created. Take note of the URL for future reference. For more information about how to create an instance, see Quick Start.
- An industry-standard protocol for the Internet of Things (IoT) and mobile Internet, which is applicable to data transmission between mobile devices. By default, Message Queue for MQTT supports this protocol.
The level of the quality of service (QoS) in message transmission. MQTT provides the following QoS levels:
- QoS0: Messages are delivered to intended Message Queue for MQTT clients at most once.
- QoS1: Messages are received by intended Message Queue for MQTT clients at least once.
- QoS2: Messages are delivered to intended Message Queue for MQTT clients exactly once.
In the MQTT protocol, cleanSession specifies whether a Message Queue for MQTT client wants to receive offline messages after a TCP connection is established for it. Set this parameter based on the following syntax:
- cleanSession=true: When an offline Message Queue for MQTT client goes online again, all its previous subscriptions and offline messages are cleaned up.
- cleanSession=false: When an offline Message Queue for MQTT client goes online again, it processes the previous offline messages, and its previous subscriptions remain effective.
Take note of the following points when you use QoS and cleanSession together:
- In the MQTT protocol, the value of cleanSession for each client cannot be modified upon each connection. Otherwise, some messages may be mistaken as offline messages.
- In the MQTT protocol, cleanSession cannot be set to false for messages with QoS2. If a Message Queue for MQTT client subscribes to such messages, the subscription does not take effect even if cleanSession is set to false.
- The cleanSession flag of P2P messages is subject to the configuration of the MQTT client that receives the messages.
Table 1 lists the results of different combinations of QoS levels and the cleanSession flag.
|QoS0||Offline messages are not delivered. Only one delivery attempt is made for online messages.||Offline messages are not delivered. Only one delivery attempt is made for online messages.|
|QoS1||Offline messages are not delivered. Online messages are guaranteed to reach the intended Message Queue for MQTT clients.||Offline messages are delivered. Both offline and online messages are guaranteed to reach the intended Message Queue for MQTT clients.|
|QoS2||Offline messages are not delivered. Online messages are delivered exactly once.||Not supported.|
- A real-time network communication method for audio and video fields. This method is used in scenarios such as voice calls, video calls, and video conferencing.
- RTC server
- A server that hosts audio-and-video media channel services, such as related services provided by Alibaba Cloud Real-Time Communication.
- Audio-and-video service management server
- A management node in the RTC system, which is also called an audio-and-video management service. You can develop your own audio-and-video management services to manage the lifecycles of all RTC sessions. Such management nodes are usually deployed on Alibaba Cloud. You can use Alibaba Cloud services to deploy your audio-and-video management services.
- Mobile audio-and-video application
- A terminal application that is used by users in the RTC system. Users use this application to initiate or join a voice or video call.
- Smart AP
- A common network device that supports application programming and can simultaneously perform Internet access and LAN device management. For example, a smart router is a smart access point (AP).
- Digital price tag
- An electronic screen in places such as shopping malls and supermarkets. Digital price tags are networked by using a wireless sensor network protocol, such as Bluetooth or ZigBee, and smart AP nodes.
- Digital price tag management service
- The backend service of a digital price tag system. It is used to manage the content that is displayed on the electronic screens and to manage and query manual tasks, such as price changes.
- A stable, reliable, and scalable online database service provided by Alibaba Cloud. It is used to persistently store task status changes such as price changes in a digital price tag system.
- Log Service
- A log storage service provided by Alibaba Cloud. This service is used to persistently store all the operation logs in a digital price tag system for auditing and tracing purposes.