All Products
Search
Document Center

ApsaraMQ for MQTT:Manage data inbound rules

Last Updated:Mar 11, 2026

Data inbound rules route messages from other Alibaba Cloud services to ApsaraMQ for MQTT clients over the MQTT protocol. You can call the API operations of the Alibaba Cloud services to send data to the ApsaraMQ for MQTT clients. Currently, only ApsaraMQ for RocketMQ is supported as a data source.

Data inbound flow

How data inbound rules work

A data inbound rule bridges a RocketMQ topic to an MQTT topic. After you enable the rule, messages published to the RocketMQ topic are automatically forwarded to the specified MQTT topic and delivered to subscribed MQTT clients.

MQTT supports multi-level topics (for example, a/b/c), while RocketMQ supports only single-level topics. To bridge this gap, the level-1 MQTT topic maps to the RocketMQ topic, and deeper levels map to RocketMQ message properties. For the complete mapping logic, see Message structure mappings between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ.

Prerequisites

Before you begin, make sure that you have:

  • An ApsaraMQ for MQTT instance with kernel version V3.x.x

  • An ApsaraMQ for RocketMQ 4.0 instance in the same region as the MQTT instance

  • A topic created on both the RocketMQ and MQTT instances

View the kernel version of an ApsaraMQ for MQTT instance in the instance list or on the Instance Details page in the ApsaraMQ for MQTT console.

Limitations

ResourceLimitDescription
Rules per instance100To request a higher quota, join DingTalk group 35228338 to contact ApsaraMQ for MQTT technical support.
Rule deduplicationOne rule of each type per internal resourceFor example, each MQTT topic supports one data inbound rule and one data outbound rule. Each group ID supports one client status notification rule.
Cross-region rulesNot supportedThe data source and data destination must reside in the same region.
MQTT instance versionKernel version V3.x.x onlyEarlier versions do not support rules.
RocketMQ instance versionApsaraMQ for RocketMQ 4.0 onlyOther versions are not supported for data inbound or outbound rules.

Usage notes

When an ApsaraMQ for RocketMQ broker is being updated, MQTT clients may receive messages with increased latency through data inbound rules. For scheduled maintenance windows, see Notice List.

Rule components

Each data inbound rule consists of three parts:

ComponentDescriptionRequired
Basic informationRule ID (globally unique, immutable after creation), description, status (enabled or disabled), and rule type.Yes
Rule sourceThe ApsaraMQ for RocketMQ instance and topic from which messages are pulled.Yes
Rule destinationThe ApsaraMQ for MQTT topic to which messages are delivered.Yes

Create a data inbound rule

  1. Log on to the ApsaraMQ for MQTT console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select the region of the target instance. Click the instance name to open the Instance Details page.

  3. In the left-side navigation pane, click Rules. In the upper-left corner of the Rules page, click Create Rule.

  4. In the Configure Basic Information step, set the following parameters and click Next.

    ParameterExampleDescription
    Rule ID111111A globally unique identifier. Supports letters, digits, hyphens (-), and underscores (_). Must contain at least one letter or digit. Length: 3-64 characters. Auto-truncated if longer. Cannot be changed after creation.
    Descriptionmigrate from rocketmqA text description for the rule.
    StatusEnableWhether to activate the rule immediately. Valid values: Enable, Disable.
    Rule TypeData InboundSelect Data Inbound to import data from other Alibaba Cloud services into ApsaraMQ for MQTT.
  5. In the Configure Rule Source step, specify the data source and click Next.

    ParameterExampleDescription
    Source Service TypeMessage Queue for Apache RocketMQThe cloud service from which data is forwarded. Only ApsaraMQ for RocketMQ is supported.
    Message Queue for Apache RocketMQ InstanceMQ_INST_13801563067\*\*\*\*\*\_BbyOD2jQThe RocketMQ instance ID. Must be in the same region as the MQTT instance.
    TopicTopic AThe RocketMQ topic whose messages are forwarded to ApsaraMQ for MQTT.
  6. In the Configure Rule Destination step, specify the target MQTT topic and click Create.

    ParameterExampleDescription
    TopicTopic BThe MQTT topic to which data is delivered. Because MQTT supports multi-level topics and RocketMQ does not, a level-1 MQTT topic maps to the RocketMQ topic, and other levels map to RocketMQ message properties. For details, see Message structure mappings between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ.

After the rule is created, it appears on the Rules page.

Manage existing rules

On the Rules page, find the target rule in the rule list. In the Actions column, choose More and select an operation:

OperationSteps
Edit a ruleSelect Edit. On the Edit Rule page, modify the parameters as needed. All parameters except Rule ID can be changed. Click Save in the Configure Rule Destination step to apply the changes.
Delete a ruleSelect Delete. In the confirmation dialog box, click OK.
Enable a ruleSelect Enable. In the confirmation dialog box, click OK.
Disable a ruleSelect Disable. In the confirmation dialog box, click OK.

Related topics