cserwen opened a new issue, #4483:
URL: https://github.com/apache/rocketmq/issues/4483
**FEATURE REQUEST**
1. Please describe the feature you are requesting.
- Support pop mode for `DefaultLitePullConsumer`.
2. Provide any additional detail on your proposed use case for this feature.
- Currently, POP mode is only supported in Push consumer. However, in the
push consumption mode, users can only passively accept messages to consume, and
cannot actively control the speed of consumption (the function of limited flow
is not very flexible).
- As we thought, pull consumer can achieve this purpose very well. However,
in some business scenarios, there may be thousands of instances in the consumer
group (which will automatically expand and shrink with traffic). If the
client-side rebalance mode is still used, it will lead to unbalanced
consumption traffic and frequent rebalance. So it is necessary to make pull
consumption to support POP mode.
- Possible code looks like this:
```java
public static void main(String[] args) throws Exception {
DefaultLitePullConsumer litePullConsumer = new
DefaultLitePullConsumer("lite_pull_consumer_test");
litePullConsumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
litePullConsumer.subscribe("pop-topic", "*");
litePullConsumer.setNamesrvAddr("localhost:9876");
litePullConsumer.setClientRebalance(false);
litePullConsumer.start();
try {
while (running) {
List<MessageExt> messageExts = litePullConsumer.poll();
for (MessageExt messageExt : messageExts) {
System.out.printf("%s=%s\n", messageExts.size(),
messageExts);
litePullConsumer.ack(messageExt);
// litePullConsumer.changePopInvisibleTime(messageExt);
//retry
}
}
} finally {
litePullConsumer.shutdown();
}
}
```
3. Indicate the importance of this issue to you (blocker, must-have,
should-have, nice-to-have). Are you currently using any workarounds to address
this issue?
- should-have
--
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]