codelipenghui commented on a change in pull request #4621: [PIP-38] Support 
batch receive in java client.
URL: https://github.com/apache/pulsar/pull/4621#discussion_r312740422
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
 ##########
 @@ -309,6 +307,36 @@ private void messageReceived(ConsumerImpl<T> consumer, 
Message<T> message) {
         }
     }
 
+    void notifyPendingBatchReceivedCallBack() {
+        OpBatchReceive<T> opBatchReceive = pendingBatchReceives.poll();
+        if (opBatchReceive == null || opBatchReceive.future == null) {
+            return;
+        }
+        notifyPendingBatchReceivedCallBack(opBatchReceive);
+    }
+
+    void notifyPendingBatchReceivedCallBack(OpBatchReceive<T> opBatchReceive) {
+        MessagesImpl<T> messages = new 
MessagesImpl<>(batchReceivePolicy.getMaxNumMessages(),
+                batchReceivePolicy.getMaxNumBytes());
+        Message<T> msgPeeked = incomingMessages.peek();
 
 Review comment:
   I have added a method getReUseableMessagesImpl() to avoid create lots of 
MessagesImpl.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to