sijie commented on a change in pull request #3079: Change un-ack messages 
tracking behavior
URL: https://github.com/apache/pulsar/pull/3079#discussion_r237218303
 
 

 ##########
 File path: 
pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
 ##########
 @@ -256,4 +257,29 @@ public void testDeadLetterTopicByCustomTopicName() throws 
Exception {
         assertNull(checkMessage);
         checkConsumer.close();
     }
+
+    @Test(timeOut = 200000)
+    public void testDeadLetterWithoutConsumerReceiveImmediately() throws 
PulsarClientException, InterruptedException {
+        final String topic = 
"persistent://my-property/my-ns/dead-letter-topic-without-consumer-receive-immediately";
+
+        Consumer<byte[]> consumer = pulsarClient.newConsumer()
+                .topic(topic)
+                .subscriptionType(SubscriptionType.Shared)
+                .subscriptionName("my-subscription")
+                .ackTimeout(3, TimeUnit.SECONDS)
+                
.deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(2).build())
+                .subscribe();
+
+        Producer<byte[]> producer = pulsarClient.newProducer()
+                .topic(topic)
+                .create();
+
+        producer.send(("a message").getBytes());
+
+        // wait a while, message will send to dead letter topic
+        Thread.sleep(15000L);
 
 Review comment:
   can we reduce the ackTimeout to 1 second or even lower, so that we can 
reduce the time here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to