Message Queue for MQTT is a light-weight messaging middleware service provided by Alibaba Cloud for mobile Internet and Internet of Things (IoT) scenarios. Traditional messaging middleware is generally used between microservices. Message Queue for MQTT, which is designed for IoT scenarios, transmits messages between devices and clouds and realizes the Internet of Everything in a real sense. This topic describes the architecture, scenarios, and benefits of Message Queue for MQTT.
In addition to Internet access, Message Queue for MQTT also supports access from virtual private clouds (VPCs). You have full control over your VPCs. For example, you can specify CIDR blocks and configure routing tables and gateways for them. In your VPCs, you can also deploy Alibaba Cloud resources, such as Elastic Compute Service (ECS), ApsaraDB RDS, and Server Load Balancer (SLB) instances.
- Topic: the topic of the message. It is a level-1 message type. A producer sends messages to a topic.
- Producer: the producer or publisher who produces and sends messages to a topic.
- Consumer: the consumer or subscriber who subscribes to and consumes messages from a topic.
- Message: the data that is sent by the producer to a topic and finally transmitted to the consumer.
- Rule: the resource that implements data exchanges between Message Queue for MQTT and other Alibaba Cloud services.
Message Queue for MQTT supports the following two messaging models:
- Model of messaging between devices
This model is applicable to data communication between mobile applications or devices. Its typical scenarios include chatting between users by using the instant messaging technology, and application-based control over smart devices. In this model, message producers and consumers are distributed in the mobile environment and connected to Message Queue for MQTT over the MQTT protocol.
- Model of interaction between devices and backend service applications
In this model, interactions between Message Queue for MQTT and other Alibaba Cloud services are implemented based on rules. This model is applicable to the following scenarios.
- A device publishes messages and a backend service application subscribes to the messages: This scenario is applicable to data reporting. A typical example is to report the status data of smart devices or report the data collected by mobile applications. In this model, a massive number of mobile devices publish messages and backend service applications subscribe to the messages. Data is generally published based on business scenarios. Message subscribers are backend service applications, which are usually deployed in Alibaba Cloud services, such as ECS. Backend service applications consume reported data in batches. Message Queue for MQTT exports data to other Alibaba Cloud services based on data outbound rules.
- A backend service application publishes messages and a device subscribes to the messages: This scenario is applicable to command issuance. A typical example is to control smart devices from a cloud or push messages from a mobile application. In this model, backend service applications publish messages. These applications are usually deployed in Alibaba Cloud services, such as ECS. Message subscribers are mobile devices or applications. Message Queue for MQTT subscribes to the data from other Alibaba Cloud services based on data inbound rules.
Based on these two models, developers who use Message Queue for MQTT are divided into device developers and cloud developers. Device developers correspond to the device side in the publish-subscribe model graph, whereas cloud developers correspond to the backend service applications in the graph. For more information about the secondary development content for the developers, see Device developer guide and Cloud developer guide.
System technology stack
Message Queue for MQTT supports transmission modes such as native persistent TCP connections, SSL encryption, and WebSocket at the data transmission layer. It also supports mainstream programming languages and platforms including C, C++, Java, iOS, and Android. The following figure shows the system technology stack of Message Queue for MQTT.
Message Queue for MQTT supports a range of protocols, languages, and platforms, and is widely used in mobile Internet and IoT fields. Its applications cover various scenarios, such as mobile live streaming, Internet of Vehicles, finance and payment, smart catering, and instant messaging.
The following figure shows the main scenarios of Message Queue for MQTT.
Message Queue for MQTT is similar to a connection gateway that has unlimited scalability. It provides closed-loop messaging and storage and rule-based data transmission. You can configure rules and use Message Queue for MQTT with other Alibaba Cloud services to implement two-way data exchanges between the cloud and your device. For example, you can use Message Queue for Apache RocketMQ, which is a traditional messaging middleware service used for applications.
Message Queue for MQTT uses a distributed architecture to eliminate single-point bottlenecks and enable unlimited scale-out among components. This architecture ensures dynamic scaling based on your online usage, and instance specifications are completely transparent to you.
The following figure shows the benefits of Message Queue for MQTT.
Message Queue for MQTT has the following benefits over other mobile messaging services.
- It supports standard protocols, such as MQTT and WebSocket. This means that additional technologies are not required for applications. You can use open source SDKs for most programming languages to seamlessly migrate your applications to Message Queue for MQTT.
- As a persistent connection gateway used by a massive number of mobile devices, Message Queue for MQTT exchanges data with other Alibaba Cloud messaging services by using backend rule engines. This way, you can implement two-way communication between your device and the cloud without the need to set up your own gateway for your applications.
- It supports device-level permission management and SSL/TLS encrypted communication to ensure higher security and reliability for data transmission.