All Products
Search
Document Center

ApsaraMQ for MQTT:Manage data inbound rules

Last Updated:Mar 15, 2024

To import data from other Alibaba Cloud services to ApsaraMQ for MQTT, you must create data inbound rules. ApsaraMQ for MQTT uses data inbound rules to obtain data from other Alibaba Cloud services and then pushes the data to ApsaraMQ for MQTT clients by using the Message Queuing Telemetry Transport (MQTT) protocol. This way, you can call the API operations of the Alibaba Cloud services to send data to the ApsaraMQ for MQTT clients.

Process

数据流入

Limits

Item

Limit

Description

Number of rules for a single instance

100

If the default value does not meet your business requirements, join DingTalk group 35228338 to contact the ApsaraMQ for MQTT technical support.

Rule deduplication

Only one rule of the same type can be created for each internal resource.

For example, you can create only one rule for client status notification for each group ID, and one data inbound rule and one data outbound rule for each topic on ApsaraMQ for MQTT.

Limits on regions

You cannot create rules across regions. The instances to which the data source and data destination in a rule belong must reside in the same region.

For example, if you create a data outbound rule in which the data source is specified as ApsaraMQ for MQTT in the China (Hangzhou) region, you can select only an ApsaraMQ for RocketMQ instance in the China (Hangzhou) region as the data destination.

ApsaraMQ for MQTT instance version

You can create rules for only instances whose kernel version is V3.x.x.

You can 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.

ApsaraMQ for RocketMQ instance version

Only ApsaraMQ for RocketMQ 4.0 instances are supported.

When you exchange data between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ by using a data inbound rule or a data outbound rule, you can use only ApsaraMQ for RocketMQ 4.0 instances.

Usage notes

When ApsaraMQ for MQTT uses a data inbound rule to receive messages from ApsaraMQ for RocketMQ, the ApsaraMQ for MQTT client may receive messages with latency if the ApsaraMQ for RocketMQ broker is being updated. For information about service updates, see Notice List.

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 where the instance that you want to manage resides. On the Instances page, click the instance name to go to 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. On the Create Rule page, perform the following steps:

    1. In the Configure Basic Information step, configure the parameters and click Next. The following table describes the parameters.

      Parameter

      Example

      Description

      Rule ID

      111111

      The rule ID. The ID is a globally unique identifier of a rule.

      • A rule ID can contain only letters, digits, hyphens (-), and underscores (_) and must contain at least one letter or digit.

      • A rule ID must be 3 to 64 characters in length. If the value contains more than 64 characters, it is automatically truncated.

      • A rule ID cannot be updated after the rule is created.

      Description

      migrate from rocketmq

      The rule description.

      Status

      Enable

      Specifies whether to enable the rule. Valid values:

      • Enable

      • Disable

      Rule Type

      Data Inbound

      The rule type. Valid values:

    2. In the Configure Rule Source step, specify the data source and click Next.

      Parameter

      Example

      Description

      Source Service Type

      Message Queue for Apache RocketMQ

      The cloud service from which the data is forwarded to ApsaraMQ for MQTT.

      Note

      Only ApsaraMQ for RocketMQ is supported.

      Message Queue for Apache RocketMQ Instance

      MQ_INST_13801563067*****_BbyOD2jQ

      The ID of the ApsaraMQ for RocketMQ instance.

      Note

      You can select only an instance that resides in the same region as the ApsaraMQ for MQTT instance.

      Topic

      Topic A

      The topic on the ApsaraMQ for RocketMQ instance. In this example, messages in Topic A are forwarded to a topic on the ApsaraMQ for MQTT instance.

    3. In the Configure Rule Destination step, specify the destination to which the data is forwarded and click Create.

      Parameter

      Example

      Description

      Topic

      Topic B

      The ApsaraMQ for MQTT topic to which you want to forward the data from other Alibaba Cloud services.

      Important

      ApsaraMQ for MQTT supports multi-level topics, whereas ApsaraMQ for RocketMQ supports one-level topics. Therefore, a level-1 topic in ApsaraMQ for MQTT is mapped to a topic in ApsaraMQ for RocketMQ, and topics of other levels in ApsaraMQ for MQTT are mapped to message properties in ApsaraMQ for RocketMQ. For information about the mappings, see Message structure mappings between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ.

    After the data inbound rule is created, you can view the rule on the Rules page.

Note For more information about the message structure mappings between ApsaraMQ for MQTT and ApsaraMQ for RocketMQ, see Message structure mappings between Message Queue for MQTT and Message Queue for Apache RocketMQ.

Modify a data inbound rule

  1. In the rule list, find the rule that you want to edit. In the Actions column, choose More > Edit.

  2. On the Edit Rule page, you can change all parameter values except the rule ID.

  3. After you change the parameter values, click Save in the Configure Rule Destination step.

Delete a data inbound rule

  1. In the rule list, find the rule that you want to delete. In the Actions column, choose More > Delete.

  2. In the message that appears, click OK.

Enable a data inbound rule

  1. In the rule list, find the rule that you want to enable. In the Actions column, choose More > Enable.

  2. In the message that appears, click OK.

Disable a data inbound rule

  1. In the rule list, find the rule that you want to disable. In the Actions column, choose More > Disable.

  2. In the message that appears, click OK.

References

For information about how to push data from ApsaraMQ for MQTT clients to other Alibaba Cloud services, see Data outbound rules.