imjyz opened a new issue, #1315:
URL: https://github.com/apache/rocketmq-clients/issues/1315
### Before Creating the Enhancement Request
- [x] I have confirmed that this should be classified as an enhancement
rather than a bug/feature.
### Programming Language of the Client
Java
### Summary
The current SimpleConsumer only provides generic receive methods and selects
the topic and message queue internally.
当前 SimpleConsumer 只提供通用 receive 方法,Topic 和 MessageQueue 均由 SDK 内部选择。
```java
CompletableFuture<List<MessageView>> receiveAsync(
int maxMessageNum,
Duration invisibleDuration);
```
Because callers cannot obtain the topic route or control the target queue,
they cannot determine how many concurrent receive requests are required to
guarantee deterministic low latency.
由于调用方无法获取 Topic 路由,也无法控制 Receive 对应的 Queue,因此无法确定需要维持多少个并发 Receive
请求才能保证确定性的低延时。
### Motivation
Even if a topic has four queues and the caller continuously maintains four
concurrent receive requests, those requests are not guaranteed to cover the
four queues individually.
即使 Topic 有 4 个 Queue,并持续维持 4 个并发 Receive 请求,也不能保证这些请求分别覆盖 4 个 Queue。
Increasing receive concurrency only reduces the probability of an uncovered
queue while increasing empty polling traffic. It cannot provide deterministic
queue coverage or latency.
继续增加 Receive 并发只能降低 Queue 未覆盖的概率,同时增加空轮询流量,无法提供确定性的 Queue 覆盖和消费延时。
Callers need to know the topic route and explicitly select the target queue
so that they can maintain one independent receive chain per queue.
调用方需要获取 Topic 路由并明确指定目标 Queue,从而为每个 Queue 维护独立的 Receive 链路。
### Describe the Solution You'd Like
The Java client already provides TopicRouteData and MessageQueueImpl. We
propose exposing the following APIs through SimpleConsumer:
Java 客户端已经存在 TopicRouteData 和 MessageQueueImpl,建议通过 SimpleConsumer 暴露以下接口:
```java
TopicRouteData getTopicRouteData(String topic)
throws ClientException;
CompletableFuture<List<MessageView>> receiveAsync(
MessageQueueImpl messageQueue,
int maxMessageNum,
Duration invisibleDuration);
```
A synchronous queue-aware receive overload can also be provided.
同时可以提供对应的同步 receive 重载。
With these APIs, callers can discover all queues for a topic and maintain
one independent receive chain per queue, providing deterministic queue coverage
and low-latency consumption without blindly increasing receive concurrency.
通过这些接口,调用方可以获取 Topic 下的全部 Queue,并为每个 Queue 维护独立 Receive 链路,从而获得确定性的 Queue
覆盖和低延时消费,而不需要盲目增加 Receive 并发数。
### Describe Alternatives You've Considered
\-
### Additional Context
_No response_
--
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]