You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/12 02:06:50 UTC

[GitHub] [pulsar] Jason918 commented on a diff in pull request #15107: [enhance] [client-consumer] Enhance robustness in consumer executeNotifyCallback.

Jason918 commented on code in PR #15107:
URL: https://github.com/apache/pulsar/pull/15107#discussion_r847877905


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -1419,40 +1428,42 @@ private ByteBuf processMessageChunk(ByteBuf compressedPayload, MessageMetadata m
      * Notify waiting asyncReceive request with the received message.
      *
      * @param message
+     * @return return true if this message is handled by pending receive.
      */
-    void notifyPendingReceivedCallback(final Message<T> message, Exception exception) {
-        if (pendingReceives.isEmpty()) {
-            return;
-        }
-
+    boolean notifyPendingReceivedCallback(final Message<T> message, Exception exception) {
         // fetch receivedCallback from queue
         final CompletableFuture<Message<T>> receivedFuture = nextPendingReceive();
         if (receivedFuture == null) {
-            return;
+            if (exception != null) {
+                log.warn("Received exception but no future to callback.", exception);
+                return true;
+            }
+            return getCurrentReceiverQueueSize() == 0;

Review Comment:
   From the semantic of method, this condition should not be handle in this method.
   And for `ZeroQueueConsumerImpl` only one message is allowed into incoming queueu.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org