nodece commented on code in PR #23624:
URL: https://github.com/apache/pulsar/pull/23624#discussion_r1851672875
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/AutoScaledReceiverQueueSizeTest.java:
##########
@@ -257,4 +266,61 @@ public void testMultiConsumerImplBatchReceive() throws
PulsarClientException, Pu
Awaitility.await().until(() -> consumer.getCurrentReceiverQueueSize()
== currentSize * 2);
log.info("getCurrentReceiverQueueSize={}",
consumer.getCurrentReceiverQueueSize());
}
+
+ @Test
+ public void testNegativeClientMemory() throws Exception {
+ final String topicName = "persistent://public/default/testMemory-" +
+ UUID.randomUUID().toString();
+ final String subName = "my-sub";
+
+ admin.topics().createPartitionedTopic(topicName, 3);
+
+ @Cleanup
+ Producer<byte[]> producer = pulsarClient.newProducer()
+ .topic(topicName)
+ .enableBatching(false)
+ .create();
+
+ final int messages = 1000;
+ List<CompletableFuture<MessageId>> messageIds = new
ArrayList<>(messages);
+ for (int i = 0; i < messages; i++) {
+ messageIds.add(producer.newMessage().key(i + "").value(("Message-"
+ i).getBytes()).sendAsync());
+ }
+ FutureUtil.waitForAll(messageIds).get();
+
+
+ @Cleanup
+ Consumer<byte[]> consumer = pulsarClient.newConsumer()
+ .topic(topicName)
+ .subscriptionName(subName)
+
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
+ .autoScaledReceiverQueueSizeEnabled(true)
+ .subscribe();
+
+ Field field =
PulsarClientImpl.class.getDeclaredField("memoryLimitController");
+ field.setAccessible(true);
+ MemoryLimitController controller = (MemoryLimitController)
field.get(pulsarClient);
Review Comment:
```suggestion
MemoryLimitController controller = ((PulsarClientImpl)
pulsarClient).getMemoryLimitController();
```
--
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]