All Products
Search
Document Center

ApsaraMQ for RocketMQ:Lite topic model

Last Updated:Jan 14, 2026

This topic describes the definition, model relationship, internal properties, behavioral constraints, version compatibility, and usage recommendations of lite topics (LiteTopics) in ApsaraMQ for RocketMQ.

Prerequisites

  • LiteTopics are currently supported only by non-serverless instances (subscription and pay-as-you-go) and dedicated serverless instances.

  • To purchase an instance version that supports the LiteTopic model:

    • For new instances, add a product capability tag on the purchase page. Set the tag key to version_capability and the tag value to lite-topic. The following figure shows an example.

      image

    • For an existing instance, you can submit a ticket to upgrade to a version that supports the LiteTopic model. Provide the instance ID and the region where the instance resides when you submit the ticket.

  • You can submit a ticket to request a free consultation on solutions for scenarios that involve LiteTopics.

Definition

A LiteTopic is a secondary container for message transmission and storage in ApsaraMQ for RocketMQ. It identifies messages of different child classes, such as different sessions or tasks, under the same business logic.

The main functions of a LiteTopic are as follows:

  • Exclusive consumption and secondary data fencing

Data from different child classes can be managed in separate LiteTopics to achieve finer-grained storage and subscription fencing.

  • Data identity and permissions

In addition to topic-based identity and permission management, you can use LiteTopics to further refine user identities and permissions.

Model relationship

In the domain model of ApsaraMQ for RocketMQ, a LiteTopic fits into the message flow as follows:

image.png

  • A topic is the top-level container for message transmission and storage in ApsaraMQ for RocketMQ. If a topic is of the Lite type, you can create LiteTopics within it. The combination of the topic and the LiteTopic uniquely identifies the message storage container.

  • If the topic type is Lite, each storage container consists of one queue by default.

Internal properties

LiteTopic name

  • Definition: The name of the LiteTopic. The name must be globally unique within the parent topic.

  • Value: If the topic type is Lite and you call setLiteTopic for a message, the system automatically creates the corresponding LiteTopic if it does not exist.

  • Constraint: For more information, see Parameter limits.

Time-to-live (TTL)

  • Definition: The time-to-live (TTL) of a LiteTopic. If a LiteTopic does not receive any messages for a period longer than its TTL, it is automatically deleted. Deleting a LiteTopic releases its quota count.

  • Value: When you create a Lite-type topic, you can set the expiration value.

  • Constraint: For more information, see Parameter limits.

Version compatibility

  • Server-side version: 5.0-rmq-20251024-1 or later

  • Client version: RocketMQ gRPC 5.1.0 or later

Differences between Lite and normal topics

Scenario

Item

Lite topic

Normal topic

Message storage

Primary topic

Same. Both require you to create topic resources in advance.

Secondary topic

You can create millions of secondary topic resources (LiteTopics) under a topic. These secondary resources have many new attributes.

No secondary topic resources.

Automated lifecycle management

The lifecycle of a secondary topic (LiteTopic) can be managed automatically:

  • Automatic creation: When you send or subscribe to a message, if the secondary topic (LiteTopic) does not exist, the resource is created automatically.

  • Automatic deletion: If you set an expiration time, the LiteTopic is automatically deleted after a period of inactivity.

None

Ordering

Each LiteTopic creates only one queue. Messages in the same queue are stored in order.

  • Each LiteTopic

Multiple queues are created. Only partitioned ordered topics guarantee order.

Maximum concurrent TPS for sending and receiving

Because there is only one queue, the maximum TPS for each LiteTopic is limited.

However, you can create millions of LiteTopics under a topic, so the total maximum TPS can increase as you add more LiteTopics.

The TPS of a topic can be scaled out horizontally based on the number of queues and cluster nodes.

Message consumption

Subscription relationship consistency

Can be inconsistent.

In the same group, each consumer can subscribe to a different collection of LiteTopics. The constraint on the group is relaxed.

Must be consistent.

In the same group, each consumer must have the same subscription relationship to share messages from the target topic.

Ordering

Ordered consumption. Messages in a LiteTopic can only be processed by one consumer thread.

You can choose concurrent consumption or ordered consumption.

Dynamic subscription

Each consumer can dynamically add or remove a subscription to a specific LiteTopic.

None

Number of LiteTopics a single consumer can subscribe to

Each consumer can subscribe to thousands of LiteTopics.

None

Observability

Metrics data

Provides message accumulation metrics.

Does not provide message processing latency metrics.

Provides message accumulation metrics.

Provides message processing latency metrics.

Message trace

Same

Common LiteTopic scenarios

Scenario 1: Asynchronous communication for Multi-Agent systems to resolve blocking from long-running calls

As AI scenarios become more complex, most single agents face limitations in complex situations. They lack specialized division of labor, struggle to integrate multiple domains, and cannot make dynamic collaborative decisions. Single-agent applications and workflows are gradually shifting toward Multi-Agent applications. However, because AI tasks are long-running, synchronous calls can block the caller's thread, causing scalability issues in large-scale collaboration.

image.png

As shown in the preceding figure, the workflow for a Multi-Agent system is as follows: A Supervisor Agent splits a request and assigns it to two sub-agents. The two sub-agents handle their respective domain-specific problems and return the results to the Supervisor Agent. The Supervisor Agent aggregates the results and returns them to the web client. The ApsaraMQ for RocketMQ asynchronous communication solution works as follows:

  1. In the request receiving flow:

    1. You can create a request topic for each sub-agent to serve as a buffer queue for tasks. This can be a priority topic to process high-priority tasks first.

    2. The Supervisor Agent sends the split task information to the corresponding request topics.

  2. In the response flow:

    1. The Supervisor Agent creates a Lite-type response topic and subscribes to it.

    2. The sub-agent processes the task and sends the response result to a LiteTopic within the response topic. The LiteTopic can be named after the task ID to create a dedicated LiteTopic for each task.

    3. The Supervisor Agent subscribes to retrieve the results in real-time and then pushes them to the web client using the HTTP Server-Sent Events (SSE) protocol.

Scenario 2: Distributed session state management to solve session management challenges in AI applications

The interaction pattern of AI applications is unique. It involves long-running, multi-turn sessions that rely heavily on high-cost computing. When an application depends on a persistent connection, such as SSE, any interruption (such as a gateway restart, connection timeout, or network instability) can cause the loss of the current session context. This also invalidates the ongoing AI task, wasting valuable computing power.

image.png

As shown in the preceding figure, the response result flow is the same as in Scenario 1. A Lite-type topic is used for real-time notification of response results. Here, each LiteTopic can be named using the SessionID (for example, chatbot/{sessionID}). This way, session results are transmitted in order as messages in this topic. The following solution describes how to maintain session continuity after a persistent connection is re-established:

  1. Web client 2 establishes a persistent connection with application service node 1 and creates Session2.

  2. Application service node 1 subscribes to the LiteTopic [chat/SessionID2].

  3. The large model task scheduling component sends the result to the LiteTopic [chat/SessionID2] based on the SessionID information in the request.

  4. Due to a network issue or other exception, the WebSocket connection automatically reconnects to application service node 2.

  5. Application service node 1 unsubscribes from the LiteTopic [chat/SessionID2], and application service node 2 subscribes to the LiteTopic [chat/SessionID2].

  6. The LiteTopic [chat/SessionID2] continues to push subsequent unconsumed messages to application service node 2 based on the previous consumption progress. This ensures the continuity of the session state and data.

Sample code

For complete examples, see the sample code in the RocketMQ 5.x gRPC SDK.

Send messages

Producer producer = provider.newProducerBuilder()
    .setTopics(topic)
    .setClientConfiguration(clientConfiguration)
    .build();

final Message message = provider.newMessageBuilder()
    .setTopic(topic)
    // Set the message key. You can use the key to accurately find a specific message.
    .setKeys("messageKey")
    // Set the LiteTopic.
    .setLiteTopic("lite-topic-1")
    // Message body.
    .setBody("messageBody".getBytes())
    .build();

try {
    final SendReceipt sendReceipt = producer.send(message);
    log.info("Send message successfully, messageId={}", sendReceipt.getMessageId());
} catch (LiteTopicQuotaExceededException e) {
    // The LiteTopic quota is exceeded. Evaluate and increase the quota.
    log.error("Lite topic quota exceeded", e);
} catch (Throwable t) {
    log.error("Failed to send message", t);
}

Consume messages

You need to use the LitePushConsumer class:

// Initialize the LitePushConsumer. You need to bind the consumer group, target topic, communication parameters, and more.
LitePushConsumer litePushConsumer = provider.newLitePushConsumerBuilder()
    .setClientConfiguration(clientConfiguration)
    // The topic bound when the consumer group was created in the console.
    .bindTopic(topicName)
    // Set the consumer group.
    .setConsumerGroup(consumerGroup)
    .setMessageListener(messageView -> {
        // Process the message and return the consumption result.
        LOGGER.info("Consume message={}", messageView);
        return ConsumeResult.SUCCESS;
    })
    .build();

try {
    // Subscribe to a collection of LiteTopics that you are interested in.
    litePushConsumer.subscribeLite("lite-topic-1");
    litePushConsumer.subscribeLite("lite-topic-2");
    litePushConsumer.subscribeLite("lite-topic-3");
} catch (LiteSubscriptionQuotaExceededException e) {
    // The LiteTopic subscription quota is exceeded. Evaluate and increase the quota.
    log.error("Lite subscription quota exceeded", e);
} catch (Throwable t) {
    log.error("Failed to subscribe lite topic", t);
}

// After business processing is complete, promptly unsubscribe from LiteTopics that are no longer in use.
litePushConsumer.unsubscribeLite("lite-topic-3");

// Get the current set of subscribed LiteTopics.
Set<String> liteTopicSet = litePushConsumer.getLiteTopicSet();

Dynamically modify subscription relationships

/**
 * Dynamically add a subscription relationship.
 * The subscribeLite() method initiates a network request and performs quota verification, so the call may fail.
 * Always check the result of this call to ensure the subscription was added successfully.
 * Possible failure scenarios include the following:
 * 1. A network request error occurs. You can retry the operation.
 * 2. Quota verification fails, and a LiteSubscriptionQuotaExceededException is thrown.
 * Evaluate whether the quota meets your needs and promptly use unsubscribeLite() to unsubscribe from topics that are no longer in use to release resources.
 */

litePushConsumer.subscribeLite("lite-topic-1");

// Dynamically delete a subscription relationship.
litePushConsumer.unsubscribeLite("lite-topic-1");

Limits

  1. A single consumer can subscribe to a maximum of 2,000 LiteTopics. You can submit a ticket to adjust this limit.

  2. The maximum consumption TPS for a single LiteTopic is 200.

  3. To ensure service stability, a limit applies to the number of LiteTopics that can be created or subscribed to within a single instance. The specific quotas are listed in the following tables. You can submit a ticket to adjust these quotas.

    1. Number of LiteTopics created

      • Definition: The total number of LiteTopics that have been created and are currently active within a single instance.

      • Trigger and impact: If this limit is reached and a client tries to send a message to a non-existent LiteTopic, which triggers automatic creation, the system cannot create the LiteTopic and returns a message sending failure.

    2. Number of LiteTopic subscriptions

      • Definition: The sum of all valid subscription relationships established between all online consumer clients and LiteTopics within an instance. This is a dynamically changing value.

      • Impact: If this limit is reached, any attempt by a consumer client to subscribe to a new LiteTopic will fail, and no new subscription relationship can be established.

      • Special rule: Even if a LiteTopic has been deleted from the system, if a consumer client still maintains a subscription to it, that subscription relationship is still counted toward the total number of subscriptions until the consumer unsubscribes.

Serverless instances

Deployment architecture

Capacity mode

Specifications

Maximum number of LiteTopics that can be created or subscribed to

Dedicated

Reserved + Elastic

5,000

300,000

10,000

600,000

15,000

720,000

[20,000, 50,000]

1,000,000

(50,000, 100,000]

1,500,000

(100,000, 200,000]

2,400,000

(200,000, 300,000]

4,700,000

(300,000, 500,000]

6,300,000

(500,000, 1,000,000]

11,600,000

Non-Serverless (subscription and pay-as-you-go) instances

Standard Edition

Instance type

Base TPS limit for message sending and receiving (ops/s)

Maximum number of LiteTopics that can be created or subscribed to

rmq.s2.2xlarge

2,000

150,000

rmq.s2.4xlarge

4,000

250,000

rmq.s2.6xlarge

6,000

300,000

Professional Edition

Instance type

Base TPS limit for message sending and receiving (ops/s)

Maximum number of LiteTopics that can be created or subscribed to

rmq.p2.2xlarge

2,000

150,000

rmq.p2.4xlarge

4,000

250,000

rmq.p2.6xlarge

6,000

300,000

rmq.p2.10xlarge

10,000

600,000

rmq.p2.20xlarge

20,000

800,000

rmq.p2.30xlarge

30,000

1,000,000

rmq.p2.40xlarge

40,000

1,200,000

rmq.p2.50xlarge

50,000

1,400,000

rmq.p2.100xlarge

100,000

2,200,000

rmq.p2.120xlarge

120,000

270 W

rmq.p2.150xlarge

150,000

3,300,000

rmq.p2.200xlarge

200,000

4.5 million

Platinum Edition

Instance type

Base TPS limit for message sending and receiving (ops/s)

Maximum number of LiteTopics that can be created or subscribed to

rmq.u2.10xlarge

10,000

600,000

rmq.u2.20xlarge

20,000

800,000

rmq.u2.30xlarge

30,000

1,000,000

rmq.u2.40xlarge

40,000

1,200,000

rmq.u2.50xlarge

50,000

1,400,000

rmq.u2.60xlarge

60,000

1,600,000

rmq.u2.70xlarge

70,000

1,700,000

rmq.u2.80xlarge

80,000

1,800,000

rmq.u2.90xlarge

90,000

2,000,000

rmq.u2.100xlarge

100,000

2,200,000

rmq.u2.120xlarge

120,000

2,700,000

rmq.u2.150xlarge

150,000

3,300,000

rmq.u2.200xlarge

200,000

4,500,000

rmq.u2.250xlarge

250,000

5,600,000

rmq.u2.300xlarge

300,000

6,300,000

rmq.u2.350xlarge

350,000

7,500,000

rmq.u2.400xlarge

400,000

9,300,000

rmq.u2.450xlarge

450,000

10,400,000

rmq.u2.500xlarge

500,000

11,600,000

rmq.u2.550xlarge

550,000

12,800,000

rmq.u2.600xlarge

600,000

14,000,000

rmq.u2.1000xlarge

1,000,000

23,200,000