alphashaw opened a new issue #5991: Consumer negative acknowledgement not 
working
URL: https://github.com/apache/pulsar/issues/5991
 
 
   **Describe the bug**
   According to doc, `When a consumer does not consume a message successfully 
at a time, and wants to consume the message again, the consumer can send a 
negative acknowledgement to the broker, and then the broker will redeliver the 
message.`
   
   If I log the message and **negative-acknowledge** it afterwards, shouldn't 
it be redeliver back to the consumer on the next **receceive()** poll?
   
   **To Reproduce**
   Below is a simple consumer testing code.
   ```
       Consumer<byte[]> consumer =
           client
               .newConsumer()
               .subscriptionType(SubscriptionType.Key_Shared)
               .subscriptionName("ks-test")
               .topic("test-topic")
               .subscribe();
       while (true) {
         Message<byte[]> message = consumer.receive(100, TimeUnit.MILLISECONDS);
         if (message != null) {
           System.out.println(new String(message.getData()));
           consumer.negativeAcknowledge(message);
         }
       }
   
   ```
   
   **Expected behavior**
   I expect to see the same message reprinted over and over as in the below 
screenshot
   
   
![correct](https://user-images.githubusercontent.com/14175735/71762980-6f14db80-2ece-11ea-9b61-fa4376fcc354.png)
   
   However, I'm seeing this. No message redelivery. Happens only after 
`ConsumerBuilder.ackTimeout()` expires. This tells me, the negative 
acknowledgement is actually not acking. Am I missing something on the consumer 
API?
   
   
![wrong](https://user-images.githubusercontent.com/14175735/71763005-bdc27580-2ece-11ea-858f-983a0d27e7a9.png)
   
   **Environment**
    - OS: Ubuntu
    - Pulser Vserion: 2.4.1
    - Java Client Version: 2.4.2
   
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to