avimas opened a new pull request #6865:
URL: https://github.com/apache/pulsar/pull/6865
Batch size is not limited to the minimum of the maxNumberOfMessages and
maxSizeOfMessages from the BatchRecieve policy.
Reproduce the issue:
public void test() throws PulsarClientException {
final String topic = "persistent://my-property/my-ns/test";
Producer<byte[]> producer =
pulsarClient.newProducer().topic(topic).blockIfQueueFull(true).create();
new Thread(() -> {
while (true) {
producer.sendAsync("".getBytes());
}
}).start();
Consumer<byte[]> consumer = pulsarClient.newConsumer()
.topic(topic)
.receiverQueueSize(1000)
.subscriptionName("test")
.batchReceivePolicy(BatchReceivePolicy.builder().maxNumBytes(1024*1024).maxNumMessages(100).timeout(1,
TimeUnit.SECONDS).build())
.subscribe();
while (true){
Messages<byte[]> msg = consumer.batchReceive();
System.out.println(msg.size());
}
}
Some of the batches will be greater than the 100
talked with @codelipenghui and advised to open this pull request
----------------------------------------------------------------
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:
[email protected]