This topic describes the association and differences between Message Queue for MQTT and traditional message-oriented middleware (MOM) such as Message Queue for Apache RocketMQ, and provides model selection recommendations in actual scenarios.

Background

Traditional MOM, such as Message Queue for Apache RocketMQ and Message Queue for Apache Kafka, is intended for microservices and big data and implements message storage and forwarding. The message producer and consumer are applications on servers.

Traditional MOM is applicable to scenarios where applications are deployed on servers that have fixed technology stacks and language platforms. However, traditional MOM cannot deal with scenarios where massive multi-platform devices developed in multiple languages need access and service properties assume an important role during message production and consumption. Examples are the mobile Internet and Internet of things (IoT) scenarios.

Designed based on the single-responsibility principle, Message Queue for MQTT is a stateless gateway designed for the mobile Internet and IoT, focusing only on the access, management, and messaging of massive mobile devices. Message Queue for MQTT can interact with other Alibaba Cloud services such as Message Queue for Apache RocketMQ based on data interaction rules.

Based on such division of responsibilities, Message Queue for MQTT routes the messages sent by devices to the specified service based on the rules defined in Message Queue for MQTT. Cloud-side applications can still use traditional microservice development solutions and interact with devices by connecting to a cloud-side storage service. Message Queue for MQTT enables data interaction between cloud-side applications and devices.

Scenario comparison

A service scenario may include different types of application components, each of which assumes a different role. Therefore, when you select a message service, you must understand the association and differences between Message Queue for MQTT and traditional MOM and use them together properly. For example, component A uses Message Queue for MQTT to send and receive messages, whereas component B uses Message Queue for Apache RocketMQ for the same purpose.

The following table describes the differences between Message Queue for MQTT and traditional MOM based on scenarios. Message Queue for Apache RocketMQ is used as an example for comparison. Other message services, such as Message Queue for Apache Kafka and Alibaba Cloud Message Queue for AMQP, observe the same rules.

Table 1. Scenario comparison
ServiceScenario

Message Queue for MQTT

Message Queue for MQTT is applicable to mobility scenarios with access by massive devices, each of which maintains a relatively small data volume. Therefore, Message Queue for MQTT can be used to process messages transmitted by a large number of online Message Queue for MQTT clients, each of which maintains a relatively small message volume. For example, many enterprises have tens of thousands of and even millions of devices.
Message Queue for Apache RocketMQMessage Queue for Apache RocketMQ is a messaging engine designed for user services deployed on servers, which is used for decoupling, asynchronous notification, and load shifting between service components. It is applicable to scenarios where a relatively small number of servers must process massive messages and require high throughput. In general, only a few enterprises have more than 10,000 servers. Therefore, Message Queue for Apache RocketMQ can be used to assist servers with massive data processing and analysis.

Scenarios of using Message Queue for MQTT and Message Queue for Apache RocketMQ together

  • Scenario 1

    In IoT scenarios, tens of thousands and even millions of sensors can use Message Queue for MQTT to upload data, and applications deployed on servers can use Message Queue for Apache RocketMQ to analyze and process the data.

  • Scenario 2

    In Internet of Vehicles (IoV) scenarios, you may need to upload information about millions of vehicles to the cloud (servers), and the cloud delivers commands to a specific vehicle or broadcasts commands to all vehicles. Vehicles can connect to Message Queue for MQTT by using the Message Queue for MQTT SDK to upload data and receive commands. Monitoring and management systems (data analysis systems) can use the Message Queue for Apache RocketMQ SDK to subscribe to messages and deliver commands, as shown in the following figure.

    comparison

Based on the preceding differences, we recommend that you use Message Queue for MQTT for mobile devices and use Message Queue for Apache RocketMQ or other message services for applications deployed on servers.

Feature comparison

The following table compares the features of Message Queue for MQTT and Message Queue for Apache RocketMQ.

Table 2. Feature comparison
FeatureMessage Queue for MQTTMessage Queue for Apache RocketMQ
Client connectionsMessage Queue for MQTT supports message processing for massive clients, which reach millions or tens of millions in quantity.Message Queue for Apache RocketMQ supports message processing for a relatively small number of servers, which is generally less than 10,000.
Message volume per clientEach Message Queue for MQTT client processes a small number of messages, and sends and receives messages at regular intervals.Each Message Queue for Apache RocketMQ client processes a large number of messages and requires high throughput.
DeploymentMessage Queue for MQTT can be used for mobile devices, apps, and HTML5 pages.Message Queue for Apache RocketMQ can be used for server-side applications.
Consumption modeMessage Queue for MQTT supports broadcasting consumption.Message Queue for Apache RocketMQ supports clustering consumption and broadcasting consumption. For more information, see Clustering consumption and broadcasting consumption.
SequenceMessages 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)Message Queue for MQTT supports many languages such as Java, C, C++, .NET, Python, JS, and Go, and systems such as Android and iOS.Message Queue for Apache RocketMQ supports Java, C++, and .NET.
Access credentialMessage Queue for MQTT supports granting permissions to Resource Access Management (RAM) users for access and using a Message Queue for MQTT token for temporary access. For more information, see Grant permissions to RAM users and Authentication overview.

Message Queue for Apache RocketMQ supports granting permissions to RAM users for access and granting permissions to another Alibaba Cloud account based on STS token for temporary access. For more information, see Grant permissions to RAM users and Grant permissions to another Alibaba Cloud account.

Model selection instructions

The following information describes the general principle of model selection:

  • We recommend that you use Message Queue for Apache RocketMQ for applications that are deployed on servers.
  • We recommend that you use Message Queue for MQTT for applications that are deployed on mobile devices, apps, or web pages.

For common scenarios, we provide the recommendations of using Message Queue for MQTT and Message Queue for Apache RocketMQ, as described in the following table.

Table 3. Model selection recommendation
ScenarioDeploymentMessage Queue for MQTTMessage Queue for Apache RocketMQ
Status data reporting by devicesMobile device×
Receiving, processing, and analysis of device-reported dataServer×
Delivery of control commands to multiple devicesServer×
Live streaming, bullet screen, and chat apps that require messagingApp×
Receiving and analysis of chat messages on serversServer×
Note

√ indicates that we recommend that you use the corresponding service, whereas × indicates that we recommend that you do not use the corresponding service.