buptxxb65 commented on code in PR #6417:
URL: https://github.com/apache/rocketmq/pull/6417#discussion_r1145612742
##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -962,27 +970,35 @@ public void run() {
subscriptionData =
FilterAPI.buildSubscriptionData(topic, subExpression4Assign);
}
- PullResult pullResult = pull(messageQueue,
subscriptionData, offset, defaultLitePullConsumer.getPullBatchSize());
- if (this.isCancelled() || processQueue.isDropped()) {
- return;
- }
- switch (pullResult.getPullStatus()) {
- case FOUND:
- final Object objLock =
messageQueueLock.fetchLockObject(messageQueue);
- synchronized (objLock) {
- if (pullResult.getMsgFoundList() != null &&
!pullResult.getMsgFoundList().isEmpty() &&
assignedMessageQueue.getSeekOffset(messageQueue) == -1) {
-
processQueue.putMessage(pullResult.getMsgFoundList());
- submitConsumeRequest(new
ConsumeRequest(pullResult.getMsgFoundList(), messageQueue, processQueue));
+ PullResult pullResult;
+ switch (communicationMode) {
+ case ASYNC:
+ PullCallback pullCallback = new PullCallback() {
+ @Override
+ public void onSuccess(PullResult pullResult) {
+ addResultToQueue(pullResult, processQueue);
}
- }
+
+ @Override
+ public void onException(Throwable e) {
+ log.warn("AsyncPull onException, info:
{}", e.toString());
+ }
+ };
+ pull(messageQueue, subscriptionData, offset,
defaultLitePullConsumer.getPullBatchSize(), pullCallback);
break;
- case OFFSET_ILLEGAL:
- log.warn("The pull request offset illegal, {}",
pullResult.toString());
+ case SYNC:
+ pullResult = pull(messageQueue, subscriptionData,
offset, defaultLitePullConsumer.getPullBatchSize());
+
+ if (this.isCancelled() ||
processQueue.isDropped()) {
+ return;
+ }
+
+ addResultToQueue(pullResult, processQueue);
break;
default:
+ assert false;
break;
}
- updatePullOffset(messageQueue,
pullResult.getNextBeginOffset(), processQueue);
} catch (InterruptedException interruptedException) {
log.warn("Polling thread was interrupted.",
interruptedException);
} catch (Throwable e) {
Review Comment:
THX! I'll correct it
--
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]