tjiuming commented on a change in pull request #14616:
URL: https://github.com/apache/pulsar/pull/14616#discussion_r826533309



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
##########
@@ -179,6 +180,23 @@ public void testBeforeSendMessage() throws 
PulsarClientException {
         
assertEquals(((CounterBrokerInterceptor)listener).getMessageDispatchCount(),1);
     }
 
+    @Test
+    public void testInterceptAck() throws Exception {
+        final String topic = "test-intercept-ack" + UUID.randomUUID();
+        BrokerInterceptor interceptor = pulsar.getBrokerInterceptor();
+        Assert.assertTrue(interceptor instanceof CounterBrokerInterceptor);
+
+        try (Producer<String> producer = 
pulsarClient.newProducer(Schema.STRING).topic(topic).create();
+             Consumer<String> consumer = 
pulsarClient.newConsumer(Schema.STRING).topic(topic)
+                     .subscriptionName("test-sub").subscribe()) {
+            producer.send("test intercept ack message");
+            Message<String> message = consumer.receive();
+            consumer.acknowledge(message);
+        }
+
+        Assert.assertEquals(((CounterBrokerInterceptor) 
interceptor).getHandleAckCount(), 1);

Review comment:
       @codelipenghui  I've read org.apache.pulsar.client.api.Consumer before, 
when consumer is closing, it will invoke AcknowledgmentsGroupingTracker#flush 
to flush all pending acks to broker. I assert the value handleAckCount after 
consumer is closed, it seems ok 




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