This article describes how to manage rules for client status notification in the Message Queue for MQTT console.

Create a rule for client status notification

For more information about the limits on rules, see Limits.

  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 outbound 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 a 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 Online/Offline Notification The type of the rule. Valid values:
    2. In the Configure Rule Source step, specify the data source and click Next.
      Parameter Example Description
      Group ID GID_Client_Status The group ID of the devices from which the status event data is exported. For more information about group IDs, see Terms.
    3. In the Configure Rule Destination step, specify the destination to which the data is forwarded and click Create.
      Parameter Example Description
      Destination Service Type Message Queue for Apache RocketMQ The cloud service to which you want to forward the status event data of a Message Queue for MQTT client.
      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 to which the data is forwarded.
      Topic TopicB The Message Queue for Apache RocketMQ topic to which the data is forwarded. In this example, the notifications about the online or offline events of a Message Queue for MQTT client are forwarded to TopicB.
    You can view the client status notification rule that you create on 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 rule for client status notification

  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 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 rule for client status notification

  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 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 rule for client status notification

  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 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 rule for client status notification

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