liudezhi2098 commented on a change in pull request #13707:
URL: https://github.com/apache/pulsar/pull/13707#discussion_r791550610



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/UnAcknowledgedMessagesTimeoutTest.java
##########
@@ -402,6 +485,68 @@ public void testCheckUnAcknowledgedMessageTimer() throws 
PulsarClientException,
         assertEquals(consumer.getUnAckedMessageTracker().size(), 0);
     }
 
+    @DataProvider(name = "variationsBackoff")
+    public static Object[][] variationsBackoff() {
+        return new Object[][]{
+                // ackTimeOutMillis / minDelayMs / maxDelayMs / multiplier
+                { 2000, 1000, 2000, 2 },
+                { 3000, 1000, 3000, 3 }
+        };
+    }
+
+    @Test(dataProvider = "variationsBackoff")
+    public void testCheckUnAcknowledgedMessageRedeliveryTimer(long 
ackTimeOutMillis, long minDelayMs,
+                                                              long maxDelayMs, 
int multiplier)
+            throws PulsarClientException, InterruptedException {
+        String key = "testCheckUnAcknowledgedMessageRedeliveryTimer";
+        final String topicName = "persistent://prop/ns-abc/topic-" + key;
+        final String subscriptionName = "my-ex-subscription-" + key;
+        final String messagePredicate = "my-message-" + key + "-";
+        final int totalMessages = 3;
+
+        // 1. producer connect
+        Producer<byte[]> producer = pulsarClient.newProducer().topic(topicName)
+                .enableBatching(false)
+                .messageRoutingMode(MessageRoutingMode.SinglePartition)
+                .create();
+
+        // 2. Create consumer
+        ConsumerImpl<byte[]> consumer = (ConsumerImpl<byte[]>) 
pulsarClient.newConsumer().topic(topicName)
+                
.subscriptionName(subscriptionName).receiverQueueSize(7).subscriptionType(SubscriptionType.Shared)
+                .ackTimeout(ackTimeOutMillis, TimeUnit.MILLISECONDS)
+                
.ackTimeoutRedeliveryBackoff(MultiplierRedeliveryBackoff.builder()
+                        .minDelayMs(minDelayMs)
+                        .maxDelayMs(maxDelayMs)
+                        .multiplier(multiplier).build())
+                .subscribe();
+
+        // 3. producer publish messages
+        for (int i = 0; i < totalMessages; i++) {
+            String message = messagePredicate + i;
+            log.info("Producer produced: " + message);
+            producer.send(message.getBytes());
+        }
+
+        Thread.sleep((long) (ackTimeOutMillis * 1.1));

Review comment:
       yes , this is an invalid code.




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