michaeljmarshall commented on a change in pull request #13023:
URL: https://github.com/apache/pulsar/pull/13023#discussion_r768184857



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -916,30 +916,32 @@ private void doPendingBatchReceiveTask(Timeout timeout) {
     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
-        try {
-            // Control executor to call MessageListener one by one.
-            if (executorQueueSize.get() < 1) {
-                final Message<T> msg = internalReceive(0, 
TimeUnit.MILLISECONDS);
-                if (msg != null) {
-                    executorQueueSize.incrementAndGet();
-                    if (SubscriptionType.Key_Shared == 
conf.getSubscriptionType()) {
-                        
executorProvider.getExecutor(peekMessageKey(msg)).execute(() ->
-                                callMessageListener(msg));
-                    } else {
-                        getExternalExecutor(msg).execute(() -> {
-                            callMessageListener(msg);
-                        });
+        internalPinnedExecutor.execute(() -> {
+            try {
+                // Control executor to call MessageListener one by one.
+                if (executorQueueSize.get() < 1) {
+                    final Message<T> msg = internalReceive(0, 
TimeUnit.MILLISECONDS);
+                    if (msg != null) {
+                        executorQueueSize.incrementAndGet();

Review comment:
       After looking at the client a bit more, we certainly follow this 
paradigm frequently. It is possible that this `internalPinnedExecutor` might 
become a bit of a bottle neck. However, I think we can keep the design as is 
for now. I opened https://github.com/apache/pulsar/pull/13273 to clean up this 
code block a bit.




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