You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chennaji9 (via GitHub)" <gi...@apache.org> on 2026/10/09 11:43:46 UTC

[I] [Bug] DefaultPullConsumer API reference: example stuck on first queue, offset ignored, wrong field/return types [rocketmq]

chennaji9 opened a new issue, #11318:
URL: https://github.com/apache/rocketmq/issues/11318

   ### Description
   
   `docs/cn/client/java/API_Reference_ DefaultPullConsumer.md` has several errors that make the page's main example wrong and its API tables inconsistent with the actual `DefaultMQPullConsumer`:
   
   **1. The example never advances past the first queue.** The `NO_NEW_MSG` branch only does `break`, which exits the `switch` — the enclosing `while(true)` then calls `pullBlockIfNotFound` on the *same* queue again. With `subExpression = null`, once a queue is drained the loop spins on that queue forever and the outer `for (MessageQueue mq : mqs)` can never reach the next queue, so the example cannot do what it demonstrates (iterate all queues of the topic).
   
   **2. The fetched consume offset is discarded.** `long offset = consumer.fetchConsumeOffset(mq, true)` is only printed; the actual pull uses `getMessageQueueOffset(mq)`, which returns `0L` for a queue missing from the local map. Even when a stored consume offset of e.g. 100 exists, the first pull starts from 0.
   
   **3. Wrong types/semantics in the tables:**
   - fields `messageModel`, `messageQueueListener`, `offsetStore`, `registerTopics`, `allocateMessageQueueStrategy` are listed as `String`/`int`; the real types are `MessageModel`, `MessageQueueListener`, `OffsetStore`, `Set<String>`, `AllocateMessageQueueStrategy` (`DefaultMQPullConsumer.java:71-89`). Code written from the table does not compile.
   - `fetchMessageQueuesInBalance` is listed as returning `long`; it returns `Set<MessageQueue>` (`DefaultMQPullConsumer.java:434`).
   - The `PullResult`-returning `pull(...)`/`pullBlockIfNotFound(...)` overloads are described as 异步 (asynchronous) — they are synchronous; only the `PullCallback` overload is asynchronous.
   - The `DefaultMQPullConsumer(RPCHook)` constructor row says it creates a 生产者 (producer).
   - `searchOffset` is described as returning the 物理offset; the broker serves the consume-queue logical offset.
   - `fetchConsumeOffset` is described as "查询给定消息队列的最大offset"; it returns the stored consume progress.
   - One method row has a duplicated `void|void`.
   
   ### Expected behavior
   
   The example should use the stored offset for the first pull and move to the next queue on `NO_NEW_MSG` (labeled break of the per-queue loop); the tables should match the real field types, return types, and sync/async semantics.


-- 
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: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] DefaultPullConsumer API reference: example stuck on first queue, offset ignored, wrong field/return types [rocketmq]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11318:
URL: https://github.com/apache/rocketmq/issues/11318#issuecomment-6095961650

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The `DefaultPullConsumer` API reference example gets stuck on the first queue and ignores offset management. The example should demonstrate proper offset tracking and multi-queue consumption.
   
   **Impact:** Documentation accuracy, API reference
   **Severity:** Medium
   
   ---
   *Automated evaluation by RockteMQ-AI*


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] DefaultPullConsumer API reference: example stuck on first queue, offset ignored, wrong field/return types [rocketmq]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11318:
URL: https://github.com/apache/rocketmq/issues/11318#issuecomment-6110382142

   **Issue Evaluation**
   
   Category: `type/documentation` | Status: **Confirmed**
   
   The `DefaultPullConsumer` API reference has multiple errors:
   1. The example never advances past the first queue — `NO_NEW_MSG` branch only does `break` (exits `switch`), so the `while(true)` loop spins on the same queue indefinitely.
   2. The offset is ignored in the example flow.
   3. Field and return types in the API tables are inconsistent with the actual `DefaultMQPullConsumer` implementation.
   
   **Suggested fix:** Add queue advancement logic in the `NO_NEW_MSG` branch, correct the offset handling, and align the API tables with the actual source code.
   
   ---
   *Automated evaluation by RocketMQ-AI*


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org