Introduction Message Queue for MQTTand provides suggestions on product selection in actual scenarios.

Background information

Traditional message-oriented middleware, such as Message Queue for Apache RocketMQand MQ for Kafka are intended for microservices, big data, and other fields, and are responsible for the storage and forwarding of messages. The Message producer and consumer are both applications on servers.

Traditional MOM is applicable in scenarios where user services deployed on ECS instances adopt fixed technology stacks and language platforms. However, traditional MOM cannot deal with scenarios with access by massive multi-platform devices developed in multiple languages, where service properties play an important role during message production and consumption. Examples are the mobile Internet and IoT scenarios.

Adhering to the principle of single responsibility, Message Queue for MQTTit is designed as a stateless gateway for the mobile Internet and IoT fields. It is only concerned with the access, management, and message transmission of massive mobile devices, and the storage of message data will be routed to backend storage products, such as the traditional message middleware. Message Queue for Apache RocketMQAnd MQ for Kafka edition.

With this division of responsibilities, terminal send messages to Message Queue for MQTTafter that, the message will be based on Message Queue for MQTTthe bound storage products are routed to the specified products, and cloud applications can still maintain the traditional microservice development solution, and can interact with terminal by connecting to the cloud storage products. Message Queue for MQTTThis enables data interoperability.

Scenario comparison

A service scenario may include different types of application components, each of which plays a different role. Therefore, when selecting a solution, you must first understand Message Queue for MQTTand traditional message-oriented middleware (MOM). They can be properly used together, for example, for sending and receiving messages of component A. Message Queue for MQTT, the message sending and receiving of component B use Message Queue for Apache RocketMQ.

The following describes the problem based on scenarios. Message Queue for MQTTCompared with traditional message-oriented middleware, traditional message-oriented middleware Message Queue for Apache RocketMQtake Alibaba Cloud MQ for Kafka and AMQP(RabbitMQ) for example.

Table 1. Scenario comparison
Service Scenario

Message Queue for MQTT

AliwareMQ for IoT is applicable in mobility scenarios with access by massive devices, each of which maintains a relatively small data volume. Therefore, Message Queue for MQTTsuitable for scenarios where there are a large number of online clients (many enterprises have tens of thousands of and even millions of devices) but each client receives a relatively small message.
Message Queue for Apache RocketMQ RocketMQ is a messaging engine that is oriented towards user services deployed on ECS instances and mainly used for decoupling, asynchronous notification, and load shifting between service components. It is applicable in scenarios with a relatively small number of ECS instances that need to process massive messages and require high throughput. In general, only a few enterprises operate more than 10,000 ECS instances. Therefore, Message Queue for Apache RocketMQDRDs is applicable to scenarios where massive data processing and analysis are performed on log service.

Scenarios of use of AliwareMQ for IoT and RocketMQ together

  • Scenario 1

    In the IoT scenario, thousands of (or even millions of) of device sensors can use Message Queue for MQTTto upload data to a server (that is, an application deployed on the server), perform data analysis by using the Message Queue for Apache RocketMQcomplete data analysis and processing.

  • Scenario 2

    On the Internet of Vehicles (IoV), you may need to upload vehicle information about millions of vehicles to the cloud (ECS instances), while the cloud delivers commands to any specific vehicles or broadcasts commands to all vehicles. The vehicle can be connected through the MQTT SDK Message Queue for MQTTto report data and receive commands, the monitoring system (data analysis system) can Message Queue for Apache RocketMQSDK to subscribe to messages and issue commands. The following figures show error messages.

    Figure 1. Comparison chart

Based on the above differences, it is recommended that you use on mobile devices. Message Queue for MQTT, while in server applications use Message Queue for Apache RocketMQ(Or other message products).

Comparison of features

Message Queue for MQTTAnd Message Queue for Apache RocketMQthe specific features of maxcompute are compared as follows:

Table 2. Comparison of features
Features Message Queue for MQTT Message Queue for Apache RocketMQ
Client connections AliwareMQ for IoT supports message processing for massive clients, which reach millions or tens of millions in quantity. RocketMQ supports message processing for a relatively small number of servers, generally less than 10,000 in quantity.
Message volume per client Each MQTT client processes a small number of messages, and sends and receives messages at regular intervals. Each MQTT client processes a large number of messages and requires high throughput.
Deployment Mobile devices, app software, and H5 pages Server-side applications
Consumption mode Broadcasting consumption SupportedClustering consumption and broadcasting consumption
Sequence Messages can be sent in order but cannot be received in order (which will be available in the future). Messages can be sent and received in order.
Multi-language/system support (TCP) Supports multiple programming languages and systems, such as Java, C, C ++,. NET, Android, iOS, Python, JS, and Go. Supports the Java, C ++, and. NET programming languages
Access credential Supported Grant permissions to RAM usersand an MQTT Token. For more information, see Authentication overview.

Supported Grant permissions to RAM usersand Grant permissions to another Alibaba Cloud account(STS temporary access authorization)

Model selection instructions

The general principle of model selection is as follows:

  • We recommend that you use Message Queue for Apache RocketMQaccess.
  • For applications deployed on mobile terminals, apps, or browser pages, we recommend that you use Message Queue for MQTTaccess.

For common application scenarios, the recommended Message Queue for MQTTand Message Queue for Apache RocketMQthe selection is as follows:

Table 3. Recommended model
Scenario Deployment Message Queue for MQTT Message Queue for Apache RocketMQ
Status data reporting by devices Mobile device Not supported
Receiving, processing, and analysis of device-reported data Mobile device Not supported
Delivery of control commands to multiple devices The Server tab Not supported
Live broadcasting, bullet screen, chat apps that require sending and receiving messages Application Not supported
Receiving and analysis of chat messages on the MQTT broker The Server tab Not supported

√ indicates that the MQ service is recommended, whereas × indicates that the MQ service is not recommended.