All Products
Search
Document Center

ApsaraMQ for Kafka:Verify an ApsaraMQ for Kafka broker with a quick test

Last Updated:Mar 11, 2026

After you deploy an ApsaraMQ for Kafka instance, run a quick end-to-end test to confirm that the broker is healthy. In this guide, you:

  • Create a test topic.

  • Send a message to the topic.

  • Confirm the message arrived by checking partition status and querying by offset.

If all steps succeed, the broker works correctly. Repeat Steps 2 through 4 a few times for a thorough check.

Note

If the broker test passes but your application fails to send messages, the issue is likely in the caller. Check your native client or ecosystem component configuration.

Prerequisites

  • An ApsaraMQ for Kafka instance is purchased, deployed, and in the Running state

Step 1: Create a test topic

  1. Log on to the ApsaraMQ for Kafka console.

  2. In the Resource Distribution section of the Overview page, select the region where your instance resides.

    Important

    Create the topic in the same region as the Elastic Compute Service (ECS) instance where your producers and consumers run. Topics cannot be used across regions. For example, if your ECS instance is in the China (Beijing) region, create the topic in the China (Beijing) region.

  3. On the Instances page, click the name of your instance.

  4. In the left-side navigation pane, click Topics.

  5. Click Create Topic.

  6. In the Create Topic panel, set the following parameters and click OK. For a quick test, use the defaults shown below. For production topics, see the full parameter descriptions in the table. After the topic is created, it appears on the Topics page.

    ParameterQuick test valueDescription
    NamedemoThe topic name.
    Descriptiondemo testA brief description.
    Partitions12The number of partitions.
    Storage EngineCloud StorageThe storage backend. Cloud Storage uses Alibaba Cloud disks with three replicas for low latency and high reliability. Local Storage uses the open-source Apache Kafka in-sync replicas (ISR) algorithm with three replicas. Standard Edition instances default to Cloud Storage. You can select Local Storage only on Professional Edition instances. If you set Instance Edition to Standard (High Write) when creating the instance, only Cloud Storage is available.
    Message TypeNormal MessageNormal Message: Messages with the same key go to the same partition in send order. If a broker fails, message order may not be preserved. Automatically set when Storage Engine is Cloud Storage. Partitionally Ordered Message: Same ordering guarantee, but order is preserved even during broker failures. Some partitions may be temporarily unavailable until restored. Automatically set when Storage Engine is Local Storage.
    Log Cleanup Policy(Not applicable for Cloud Storage)Available only for Local Storage on Professional Edition instances. Delete (default): Retains messages based on the maximum retention period. When storage usage exceeds 85%, the earliest messages are deleted. Compact: Retains only the latest value for each key. Used with components like Kafka Connect and Confluent Schema Registry. For details, see log compaction in Apache Kafka and aliware-kafka-demos.
    TagdemoOptional resource tag.

Step 2: Send a test message

  1. On the Topics page, click the name of the topic you created (for example, demo).

  2. In the upper-right corner of the Topic Details page, click Send Message.

  3. In the Start to Send and Consume Message panel, select a Sending Method: Console, Docker, or SDK. Follow the instructions for the method you selected.

Console

  1. In the Message Key field, enter a key. Example: demo.

  2. In the Message Content field, enter the message body. Example: {"key": "test"}.

  3. For Send to Specified Partition:

    • Select Yes and enter a Partition ID (for example, 0) to send the message to a specific partition. To find partition IDs, see View partition status.

    • Select No to let ApsaraMQ for Kafka assign the partition automatically.

  4. Click OK to send the message.

Docker

  1. Run the Docker commands in the Run the Docker container to produce a sample message section to send a test message.

  2. Run the Docker commands in the How do I consume a message after the message is sent? section to consume the message.

SDK

Select an SDK for your programming language or framework, choose an access method, and follow the on-screen instructions to send and consume a test message.

Step 3: Check partition status

Check the partition status to verify that the message arrived.

  1. On the Topics page, click the name of the topic you used (for example, demo).

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

  3. Confirm that the partition you sent the message to shows an updated Maximum Offset and Last Updated At timestamp. An increase in Maximum Offset confirms the message was stored successfully.

    ParameterDescription
    Partition IDThe partition ID.
    Minimum OffsetThe earliest offset in the partition.
    Maximum OffsetThe latest offset in the partition. If this value increased after you sent the message, the message was stored successfully.
    MessagesThe total number of messages in the partition.
    Last Updated AtThe time when the most recent message was stored.

    Partition status

Step 4: Query the message by offset

Retrieve the test message to confirm it was stored correctly.

  1. Log on to the ApsaraMQ for Kafka console.

  2. In the Resource Distribution section of the Overview page, select the region where your instance resides.

  3. On the Instances page, click the name of your instance.

  4. In the left-side navigation pane, click Message Query.

  5. From the Search Method drop-down list, select Search by offset.

  6. Select the topic and partition from the Topic and Partition drop-down lists, enter an offset value in the Offset field, and click Search. Messages with offsets greater than or equal to the specified value are returned. For example, if you select Partition 5 and enter Offset 5, all messages with offsets equal to or greater than 5 from Partition 5 are displayed.

  7. Verify that the Key and Value columns match the message you sent. If the key is demo and the value is {"key": "test"}, the broker stored and retrieved the message correctly.

    ParameterDescription
    PartitionThe partition the message was retrieved from.
    OffsetThe message offset.
    KeyThe message key, displayed as a string.
    ValueThe message content, displayed as a string.
    Created AtThe timestamp when the message was sent. This is either the client-recorded timestamp or the value of the ProducerRecord timestamp field. If you did not specify a value for the timestamp field, the local system time when the message was sent is displayed. If the timestamp field was set to 0 or an invalid value, the time is displayed in 1970/x/x x:x:x format. Clients on ApsaraMQ for Kafka version 0.9 or earlier cannot set the timestamp field.
    ActionsDownload Key: Download the message key. Download Value: Download the message content.
    Important
    • The console displays up to 1 KB of content per message. Longer messages are truncated. Download the message to view the full content.

    • Each download is limited to 10 MB. If the query results exceed 10 MB, only the first 10 MB can be downloaded.

Clean up test resources

After a successful test, delete the test topic to free storage and avoid unnecessary resource consumption. On the Topics page, locate the test topic and click Delete.