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: [email protected]

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

Reply via email to