This section describes how to manage data inbound rules in the Message Queue for MQTT console.

Background information

You must create data inbound rules before you can import data from other Alibaba Cloud services to Message Queue for MQTT. Message Queue for MQTT uses data inbound rules to obtain data from other Alibaba Cloud services. Then, the Message Queue for MQTT broker pushes the data to Message Queue for MQTT clients by using the Message Queuing Telemetry Transport (MQTT) protocol. You can call the APIs of the Alibaba Cloud services to send data to the Message Queue for MQTT clients. Inbound data

Limits

For more information, see Rule-related limits.

Precautions

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

Create a data inbound rule

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance for which you want to create a data inbound rule in the instance list. In the Actions column, choose More > Rules.
  5. In the upper-left corner of the Rules page, click Create Rule.
  6. On the Create Rule page, perform the following steps:
    1. In the Configure Basic Information step, set the following parameters and click Next.
      Parameter Example Description
      Rule ID 111111 The global unique identifier of the rule.
      • It can contain only letters, digits, hyphens (-), and underscores (_) and must contain at least one letter or digit.
      • It must be 3 to 64 characters in length. If the value contains more than 64 characters, it is automatically truncated.
      • It cannot be updated after the rule is created.
      Description migrate from rocketmq The description of the rule.
      Status Enable Specifies whether to enable the current rule. Valid values:
      • Enable
      • Disable
      Rule Type Data Inbound The type of the rule. 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 Message Queue for MQTT.
      Note Only Message Queue for Apache RocketMQ is supported.
      Message Queue for Apache RocketMQ Instance MQ_INST_13801563067*****_BbyOD2jQ The ID of the Message Queue for Apache RocketMQ instance from which the data is forwarded.
      Note You can select only an instance that resides in the same region as the Message Queue for MQTT instance.
      Topic TopicA The Message Queue for Apache RocketMQ topic from which the data is forwarded. In this example, the messages of TopicA are forwarded to a topic of Message Queue for MQTT.
    3. In the Configure Rule Destination step, specify the source from which the data is forwarded and click Create.
      Parameter Example Description
      Topic TopicB The topic of Message Queue for MQTT to which the data is forwarded from other Alibaba Cloud services.
    You can view the data inbound rule that you create on the Rules page.
Note For more information about the message structure mappings between Message Queue for MQTT and Message Queue for Apache RocketMQ, see Message structure mappings between Message Queue for MQTT and Message Queue for Apache RocketMQ.

Edit a data inbound rule

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select the region where your instance is located.
  4. Find the instance for which you want to create a data outbound rule in the instance list. In the Actions column, choose More > Rules.
  5. In the rule list, find the rule that you want to edit. In the Actions column, choose More > Edit.
  6. On the Edit Rule page, you can change all parameter values except the rule ID.
  7. After you change parameter values as needed, click Save in the Configure Rule Destination step.

Delete a data inbound rule

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select the region where your instance is located.
  4. Find the instance for which you want to create a data outbound rule in the instance list. In the Actions column, choose More > Rules.
  5. In the rule list, find the rule that you want to delete. In the Actions column, choose More > Delete.
  6. In the message that appears, click OK.

Enable a data inbound rule

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select the region where your instance is located.
  4. Find the instance for which you want to create a data outbound rule in the instance list. In the Actions column, choose More > Rules.
  5. In the rule list, find the rule that you want to enable. In the Actions column, choose More > Enable.
  6. In the message that appears, click OK.

Disable a data inbound rule

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select the region where your instance is located.
  4. Find the instance for which you want to create a data outbound rule in the instance list. In the Actions column, choose More > Rules.
  5. In the rule list, find the rule that you want to disable. In the Actions column, choose More > Disable.
  6. In the message that appears, click OK.