All Products
Search
Document Center

ApsaraMQ for Kafka:Handle inactive topics

Last Updated:Mar 11, 2026

Inactive topics -- topics with no recent message activity -- still consume resources. Identify and delete these topics to reduce the amount of occupied resources on your ApsaraMQ for Kafka instance.

Identify inactive topics

Two metrics determine whether a topic is inactive:

MetricWhat it tells youInactive when
TotalCountTotal number of messages stored on the broker for this topicIn most cases, value is 0
LastTimeStampTimestamp of the most recent messageIn most cases, value points to a time long ago
If LastTimeStamp is 0 or a negative value, the system has not retrieved the timestamp. Do not treat the topic as inactive in this case.

Check topic status in the console

  1. Log on to the ApsaraMQ for Kafka 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 name of the instance that you want to manage.

  3. In the left-side navigation pane, click Topics, then click the topic name.

  4. On the Topic Details page, click the Partition Status tab.

  5. Review the TotalCount and LastTimeStamp values. If the topic meets the inactive criteria in the preceding table, note the topic name for cleanup.

Check topic status through API operations

Use the following API operations to check activity across all topics at once.

  1. Call GetTopicList to retrieve all topics on an instance.

  2. Call GetTopicStatus for each topic to retrieve its messaging status.

  3. In each response, check the TotalCount and LastTimeStamp fields against the criteria in the preceding table. Skip any topic where LastTimeStamp is 0 or negative, because the timestamp is unavailable.

  4. Record the names of all inactive topics for cleanup.

Delete an inactive topic

After you confirm that a topic is inactive and safe to remove, delete it from the console.

Warning
  • You must determine whether an inactive topic is to be deleted.

  • We recommend that you do not automate topic deletion through API operations. Programmatic errors may cause irreversible business losses.

  1. Log on to the ApsaraMQ for Kafka 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 name of the instance that you want to manage.

  3. In the left-side navigation pane, click Topics, then click the topic name.

  4. In the upper-right corner of the Topic Details page, click Delete.

  5. In the confirmation dialog, click OK.

Important

Confirm the information before you delete a topic.