codelipenghui commented on a change in pull request #11455:
URL: https://github.com/apache/pulsar/pull/11455#discussion_r681364064



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -895,24 +897,27 @@ private void pendingBatchReceiveTask(Timeout timeout) 
throws Exception {
     protected void triggerListener() {
         // Trigger the notification on the message listener in a separate 
thread to avoid blocking the networking
         // thread while the message processing happens
-        Message<T> msg;
-        do {
-            try {
-                msg = internalReceive(0, TimeUnit.MILLISECONDS);
+        try {
+            // Control executor to call MessageListener one by one.
+            if (executorQueueSize.get() < 1) {

Review comment:
       LGTM, the incoming messages will trigger the listener and add the 
message to the thread pool, so the executorQueueSize is required.




-- 
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