gaoran10 commented on code in PR #357:
URL: 
https://github.com/apache/pulsar-client-node/pull/357#discussion_r1440408093


##########
tests/consumer.test.js:
##########
@@ -315,6 +346,47 @@ const Pulsar = require('../index');
         consumer.close();
         dlqConsumer.close();
       });
+
+      test('Batch Receive', async () => {
+        const topicName = 'batch-receive-test-topic';
+        const producer = await client.createProducer({
+          topic: topicName,
+        });
+
+        const consumer = await client.subscribe({
+          topic: topicName,
+          subscription: 'sub1',
+          subscriptionType: 'Shared',
+          batchReceivePolicy: {
+            maxNumMessages: 10,
+            maxNumBytes: -1,
+            timeoutMs: 500,

Review Comment:
   Could we add a case? Such as sending messages less than 10 to verify timeout 
works well.



##########
src/ConsumerConfig.cc:
##########
@@ -265,6 +291,39 @@ ConsumerConfig::ConsumerConfig(const Napi::Object 
&consumerConfig, pulsar_messag
     }
     pulsar_consumer_configuration_set_dlq_policy(this->cConsumerConfig.get(), 
&dlq_policy);
   }
+
+  if (consumerConfig.Has(CFG_BATCH_RECEIVE_POLICY) &&
+      consumerConfig.Get(CFG_BATCH_RECEIVE_POLICY).IsObject()) {
+    Napi::Object propObj = 
consumerConfig.Get(CFG_BATCH_RECEIVE_POLICY).ToObject();
+    int maxNumMessages = -1;
+    if (propObj.Has(CFG_BATCH_RECEIVE_POLICY_MAX_NUM_MESSAGES) &&

Review Comment:
   I found Java client will use the `receiverQueueSize` if `maxNumMessages` is 
bigger than the `receiverQueueSize`, I'm not sure whether we can add this check 
in the node client.



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