You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/02 18:08:27 UTC

[GitHub] [pulsar-client-go] alivannikov opened a new issue #501: Semantics behind MaxDeliveries property

alivannikov opened a new issue #501:
URL: https://github.com/apache/pulsar-client-go/issues/501


   What is the meaning of `MaxDeliveries` property in `DLQPolicy`, should it equal to total deliveries including original attempt or should it equal to desired number or retries?
   
   PIP document https://github.com/apache/pulsar/wiki/PIP-58-%3A-Support-Consumers--Set-Custom-Retry-Delay and Java client implementation define it like this:
   
   `/**
        * Maximum number of times that a message will be redelivered before
   being sent to the dead letter queue.
        */
       private int maxRedeliverCount;`
   
   However, Go client implementation defines it like this:
   
   `// Maximum number of times that a message will be delivered before being sent to the dead letter queue.
   	MaxDeliveries uint32`
   
   To better understand meaning behind I also checked how those values used in tests. It seems there are actually two a bit different contexts when redelivery happens in Pulsar:
   1. When client Nack the message or Ack timeout.
   2. When client uses `reconsumeLater` api.
   
   **Java client tests**
   _Test for Nack_
   https://github.com/apache/pulsar/blob/6704f12104219611164aa2bb5bbdfc929613f1bf/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java#L101
   Here we can see that meaning is really redelivery, we expect to get redelivery+1 messages, so redelivery count plus original attempt.
   _Test for reconsumeLater_
   https://github.com/apache/pulsar/blob/6704f12104219611164aa2bb5bbdfc929613f1bf/pulsar-broker/src/test/java/org/apache/pulsar/client/api/RetryTopicTest.java#L90
   Same meaning, we expect to get redelivery+1 messages.
   
   **Go client tests**
   _Test for reconsumeLater_
   https://github.com/apache/pulsar/blob/6704f12104219611164aa2bb5bbdfc929613f1bf/pulsar-broker/src/test/java/org/apache/pulsar/client/api/RetryTopicTest.java#L90
   Same expectations. So at this point I started to think that it is just bad naming in Go client, since `MaxDeliveries` value is used to provide max redeliveries actually. But
   _Test for Nack_
   https://github.com/apache/pulsar-client-go/blob/5fb7f55939e6f4ec28126339b22a6b4018c0f2fa/pulsar/consumer_test.go#L981
   The meaning of value here is total deliveries. And this is the point where I am totally confused. How this test even passes in Go? It differs from corresponding Java `reconsumeLater` test expectations.


-- 
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:
users@infra.apache.org