tju-yxq opened a new issue, #1605:
URL: https://github.com/apache/rocketmq-dashboard/issues/1605

   ## Bug Report
   
   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions) of this repository 
and believe that this is not a duplicate.
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   ### Runtime platform environment
   
   OS: Ubuntu 20.04 / Any OS running RocketMQ Studio
   
   ### RocketMQ version
   
   branch: rocketmq-studio
   Git commit id: bce4b10
   
   ### JDK Version
   
   OpenJDK 21
   
   ### Describe the Bug
   
   `TencentInstanceProvider.getTopicConsumers()` fetches only the first page of 
consumers (offset=0, limit=100) without paginating through additional pages. If 
a topic has more than 100 consumer groups, only the first 100 are returned — 
the rest are silently dropped.
   
   ```java
   request.setOffset(0L);
   request.setLimit((long) CONSUMER_PAGE_SIZE);  // CONSUMER_PAGE_SIZE = 100
   // No pagination loop — only fetches 1 page
   ```
   
   Compare with `listTopics()` which correctly paginates through all results 
using a `for (int page = 0; page < MAX_PAGES; page++)` loop.
   
   ### Impact
   
   - Topics with >100 consumer groups show incomplete consumer lists in the 
Studio UI
   - Users may miss important consumer groups when diagnosing consumption issues
   - The issue is silent — no error or warning is logged when results are 
truncated
   
   ### Steps to Reproduce
   
   1. Create a Tencent Cloud RocketMQ topic with 150+ consumer groups 
subscribing to it.
   2. In RocketMQ Studio, navigate to the topic detail page and view the 
"Consumers" tab.
   3. Observe: only 100 consumers are listed, the remaining 50+ are missing.
   
   ### What Did You Expect to See?
   
   All consumer groups should be returned, with pagination through all 
available pages.
   
   ### What Did You See Instead?
   
   Only the first 100 consumer groups are returned.
   
   ### Additional Context
   
   **Affected file**: 
`server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentInstanceProvider.java`,
 method `getTopicConsumers()` at approximately line 207.
   
   **Fix**: Add a pagination loop similar to `listTopics()`:
   
   ```java
   public List<TopicConsumerVO> getTopicConsumers(String instanceId, String 
topicName) {
       Context context = resolve(instanceId);
       requireTopicName(topicName);
       List<TopicConsumerVO> consumers = new ArrayList<>();
       for (int page = 0; page < MAX_PAGES; page++) {
           DescribeTopicRequest request = new DescribeTopicRequest();
           request.setInstanceId(context.cloudInstanceId());
           request.setTopic(topicName);
           request.setOffset((long) page * CONSUMER_PAGE_SIZE);
           request.setLimit((long) CONSUMER_PAGE_SIZE);
           DescribeTopicResponse response = 
clientFactory.call(context.credentialId(), context.regionId(),
                   client -> client.DescribeTopic(request));
           SubscriptionData[] data = response == null ? null : 
response.getSubscriptionData();
           if (data == null || data.length == 0) {
               break;
           }
           for (SubscriptionData subscription : data) {
               if (subscription != null) {
                   consumers.add(toTopicConsumer(subscription));
               }
           }
           if (data.length < CONSUMER_PAGE_SIZE) {
               break;
           }
       }
       return consumers;
   }
   ```
   
   This adds a pagination loop (~10 lines) matching the pattern already used by 
`listTopics()`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to