codelipenghui commented on a change in pull request #14616:
URL: https://github.com/apache/pulsar/pull/14616#discussion_r826513672
##########
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:
Need to add `Awaitility.await()` here, for Pulsar consumers, it will not
send out the acknowledge command immediately, without some retry policies, here
should be a flaky test.
--
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]