All Products
Search
Document Center

ApsaraMQ for MQTT:Server-side data forwarding

Last Updated:Aug 22, 2024

ApsaraMQ for MQTT allows you to forward data between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ. This topic describes the property mappings during data forwarding.

Feature description

ApsaraMQ for MQTT can interact with other Alibaba Cloud services such as ApsaraMQ for RocketMQ based on data interaction rules. For more information about the rules, see Manage data inbound rules.

Limits

  • Message Queuing Telemetry Transport (MQTT) 5.0 must be supported by the ApsaraMQ for MQTT instance.

  • The version of the ApsaraMQ for RocketMQ instance must be 4.x.

Property mappings

ApsaraMQ for MQTT SDKs and ApsaraMQ for RocketMQ can be used to consume and send messages in MQTT 5.0. You can also configure and specify user properties. The following table describes the property mappings between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ.

ApsaraMQ for MQTT parameter

ApsaraMQ for RocketMQ property key

Valid property value

Description

QoS

qoslevel

0, 1, and 2.

You can configure this property when messages are sent from ApsaraMQ for RocketMQ to ApsaraMQ for MQTT. If you do not configure this property, the default value 1 is used.

ApsaraMQ for RocketMQ can directly read this property from messages that are sent from ApsaraMQ for MQTT.

Topic

topic

A string that indicates a specific topic.

You cannot configure this property. This property is used to trace all topics from which messages are sent from ApsaraMQ for MQTT to ApsaraMQ for RocketMQ.

Subtopic

mqttSecondTopic

A string that indicates a specific subtopic.

You can configure this property only when subtopics are used to filter messages that are sent from ApsaraMQ for RocketMQ to ApsaraMQ for MQTT. If you do not configure this property, it is left empty.

ApsaraMQ for RocketMQ can directly read this property from messages that are sent from ApsaraMQ for MQTT.

Topic in messages received on a client

mqttRealTopic

The sub-level string that the business expects message-receiving clients to display.

You can configure this property only when an ApsaraMQ for MQTT client is expected to display the specified subtopic name after the client receives messages from ApsaraMQ for RocketMQ. In most cases, this property is applied to P2P messages. If you do not configure this property, P2P messages use a fixed topic name.

This property is unavailable when messages are sent from ApsaraMQ for MQTT to ApsaraMQ for RocketMQ.

clientId

clientId

A string that indicates a specific client ID

You cannot configure this property. This property is used to trace the ID of the ApsaraMQ for MQTT client from which messages are sent to ApsaraMQ for RocketMQ.

User property of messages

mqtt5UserProperty

The user property cannot exceed 8 KB in length. Example:

[{"key":"mQ","value":"test001"},{"key":"MQ","value":"test002"}]

The user property that is specified when messages are sent.

Message expiration time

mqtt5MsgExpireInterval

0 to 65535. Unit: seconds.

The expiration time that is specified when messages are sent.

Message content type

mqtt5ContentType

UTF-8

The format in which messages are encoded when the messages are sent.