This topic describes how to clear the subscriptions for a topic in the Message Queue for MQTT console.

Background information

The following items provide the background and billing information about the subscription cleanup feature:

  • After the subscription cleanup feature is enabled for a topic, Message Queue for MQTT deletes the subscription between the subscriber and the topic if the subscriber client keeps offline for a period of time that exceeds the specified limit. If the subscription is not cleared, the subscription remains valid when the subscriber client is offline. When the client goes online again, Message Queue for MQTT automatically loads offline messages and sends them to the client.
  • Assume that you have a timeliness requirement for offline messages or you determine that a subscriber is invalid and is no longer needed for specific business. In this case, you can enable this feature to clear the subscriptions between the subscriber and the topics to which it subscribed.
  • Message Queue for MQTT determines whether to automatically load offline messages and send them to the client based on the values of the QoS and cleanSession parameters. For more information, see Terms.
  • Subscription changes affect the billing of the related instance. For more information, see Overview.
  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 topic in the instance list. In the Actions column, choose More > Topics.
  5. On the Topics page, find the topic for which you want to configure the subscription cleanup feature, and click Subscription Cleanup in the Actions column.
  6. In the Subscription Relationship Clearance panel, set Enable Automatic Subscription Cleanup and Cleanup Cycle, and click OK.
    • If you set Enable Automatic Subscription Cleanup to Yes, the system clears the subscription between the subscriber and the topic when the value obtained by subtracting the last heartbeat time of the client from the current system time is no less than the value of Cleanup Cycle. After the subscription is cleared, the client no longer receives offline messages generated by the topic.
      Notice When the client goes online again, it can still receive offline messages that are generated before the subscription is cleared and are within the validity period.
    • If you set Enable Automatic Subscription Cleanup to No, the system does not clear the subscription between the subscriber and the topic when the subscriber client is offline. The subscription remains valid.
    After the configuration is complete, you can view the subscription cleanup cycle in the Subscription Cleanup Cycle column of the topic.