Anonymitaet commented on a change in pull request #12660:
URL: https://github.com/apache/pulsar/pull/12660#discussion_r744630910
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -336,6 +336,7 @@ When you create a consumer, you can use the `loadConf`
configuration. The follow
`deadLetterPolicy`|DeadLetterPolicy|Dead letter policy for consumers.<br /><br
/>By default, some messages are probably redelivered many times, even to the
extent that it never stops.<br /><br />By using the dead letter mechanism,
messages have the max redelivery count. **When exceeding the maximum number of
redeliveries, messages are sent to the Dead Letter Topic and acknowledged
automatically**.<br /><br />You can enable the dead letter mechanism by setting
`deadLetterPolicy`.<br /><br />**Example**<br /><br
/><code>client.newConsumer()<br
/>.deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(10).build())<br
/>.subscribe();</code><br /><br />Default dead letter topic name is
`{TopicName}-{Subscription}-DLQ`.<br /><br />To set a custom dead letter topic
name:<br /><code>client.newConsumer()<br
/>.deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(10)<br
/>.deadLetterTopic("your-topic-name").build())<br />.subscribe();</code><br
/><br />When specifying the dead
letter policy while not specifying `ackTimeoutMillis`, you can set the ack
timeout to 30000 millisecond.|None
`autoUpdatePartitions`|boolean|If `autoUpdatePartitions` is enabled, a
consumer subscribes to partition increasement automatically.<br /><br
/>**Note**: this is only for partitioned consumers.|true
`replicateSubscriptionState`|boolean|If `replicateSubscriptionState` isĀ
enabled, a subscription state is replicated to geo-replicated clusters.|false
+`negativeAckRedeliveryBackoff`|NegativeAckRedeliveryBackoff|Interface for
custom message is negativeAcked policy, users can specify a
`NegativeAckRedeliveryBackoff` for a consumer.|
`NegativeAckRedeliveryExponentialBackoff`
Review comment:
what is the meaning of "interface xx is xx policy" (interface is
policy?)?
```suggestion
`negativeAckRedeliveryBackoff`|NegativeAckRedeliveryBackoff|Interface for
custom message is negativeAcked policy. You can specify
`NegativeAckRedeliveryBackoff` for a consumer.|
`NegativeAckRedeliveryExponentialBackoff`
```
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -402,6 +403,25 @@ consumer.acknowledge(messages)
> .build();
> ```
+### NegativeAckRedeliveryBackoff
+
+The `NegativeAckRedeliveryBackoff` is to introduce a redelivery backoff
mechanism which we can achieve redelivery with different delays according to
the redeliveryCount the message is retried.
Review comment:
```suggestion
The `NegativeAckRedeliveryBackoff` introduces a redelivery backoff
mechanism. You can achieve redelivery with different delays by setting
`redeliveryCount ` of messages.
```
do you mean this?
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -402,6 +403,25 @@ consumer.acknowledge(messages)
> .build();
> ```
+### NegativeAckRedeliveryBackoff
+
+The `NegativeAckRedeliveryBackoff` is to introduce a redelivery backoff
mechanism which we can achieve redelivery with different delays according to
the redeliveryCount the message is retried.
+
+```java
+Consumer consumer = client.newConsumer()
+ .topic("my-topic")
+ .subscriptionName("my-subscription")
+
.negativeAckRedeliveryBackoff(NegativeAckRedeliveryExponentialBackoff.builder()
+ .minNackTimeMs(1000)
+ .maxNackTimeMs(60 * 1000)
+ .build())
+ .subscribe();
+```
+
+> Notice:
+> 1. The negativeAckRedeliveryBackoff will not work with
`consumer.negativeAcknowledge(MessageId messageId)` because we are not able to
get the redelivery count from the message ID.
Review comment:
```suggestion
> - The `negativeAckRedeliveryBackoff` does not work with
`consumer.negativeAcknowledge(MessageId messageId)` because you are not able to
get the redelivery count from the message ID.
```
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -402,6 +403,25 @@ consumer.acknowledge(messages)
> .build();
> ```
+### NegativeAckRedeliveryBackoff
+
+The `NegativeAckRedeliveryBackoff` is to introduce a redelivery backoff
mechanism which we can achieve redelivery with different delays according to
the redeliveryCount the message is retried.
+
+```java
+Consumer consumer = client.newConsumer()
+ .topic("my-topic")
+ .subscriptionName("my-subscription")
+
.negativeAckRedeliveryBackoff(NegativeAckRedeliveryExponentialBackoff.builder()
+ .minNackTimeMs(1000)
+ .maxNackTimeMs(60 * 1000)
+ .build())
+ .subscribe();
+```
+
+> Notice:
Review comment:
```suggestion
> **Note**
```
##########
File path: site2/docs/concepts-messaging.md
##########
@@ -185,6 +185,21 @@ consumer.negativeAcknowledge(msg);
> **Note**
> If batching is enabled, all messages in one batch are redelivered to the
> consumer.
+### Negative Redelivery Backoff
Review comment:
```suggestion
### Negative redelivery backoff
```
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -402,6 +403,25 @@ consumer.acknowledge(messages)
> .build();
> ```
+### NegativeAckRedeliveryBackoff
Review comment:
Does this belong to`Negative Ack` in [this
sheet](https://docs.google.com/spreadsheets/d/1YHYTkIXR8-Ql103u-IMI18TXLlGStK8uJjDsOOA0T20/edit#gid=1784579914&range=B73:C73)?
If so, how about changing the heading to `Negative acknowledgment`?
##########
File path: site2/docs/concepts-messaging.md
##########
@@ -185,6 +185,21 @@ consumer.negativeAcknowledge(msg);
> **Note**
> If batching is enabled, all messages in one batch are redelivered to the
> consumer.
+### Negative Redelivery Backoff
+
+In general, the consumer is not able to process the message successfully, what
we can use [Negative acknowledgement](concepts-messaging.md#Negative
acknowledgement) and redeliver the message after processing the message failure
so that the message can be redelivered to other consumers(for the Shared
subscription).
+
+But this is not flexible enough, so we introduce a redelivery backoff
mechanism which we can achieve redelivery with different delays according to
the number of times the message is retried.
Review comment:
```suggestion
But this is not flexible enough. A better way is to use the **redelivery
backoff mechanism**. You can redeliver messages with different delays by
setting the number of times the messages is retried.
```
do you mean this?
##########
File path: site2/docs/concepts-messaging.md
##########
@@ -185,6 +185,21 @@ consumer.negativeAcknowledge(msg);
> **Note**
> If batching is enabled, all messages in one batch are redelivered to the
> consumer.
+### Negative Redelivery Backoff
+
+In general, the consumer is not able to process the message successfully, what
we can use [Negative acknowledgement](concepts-messaging.md#Negative
acknowledgement) and redeliver the message after processing the message failure
so that the message can be redelivered to other consumers(for the Shared
subscription).
Review comment:
```suggestion
In general, consumers are not able to process messages successfully. In this
case, you can use [negative
acknowledgement](concepts-messaging.md#negative-acknowledgement) and redeliver
the messages after processing message failures, so that the messages can be
redelivered to other consumers (for the Shared subscription).
```
do you mean this?
##########
File path: site2/docs/client-libraries-java.md
##########
@@ -402,6 +403,25 @@ consumer.acknowledge(messages)
> .build();
> ```
+### NegativeAckRedeliveryBackoff
+
+The `NegativeAckRedeliveryBackoff` is to introduce a redelivery backoff
mechanism which we can achieve redelivery with different delays according to
the redeliveryCount the message is retried.
+
+```java
+Consumer consumer = client.newConsumer()
+ .topic("my-topic")
+ .subscriptionName("my-subscription")
+
.negativeAckRedeliveryBackoff(NegativeAckRedeliveryExponentialBackoff.builder()
+ .minNackTimeMs(1000)
+ .maxNackTimeMs(60 * 1000)
+ .build())
+ .subscribe();
+```
+
+> Notice:
+> 1. The negativeAckRedeliveryBackoff will not work with
`consumer.negativeAcknowledge(MessageId messageId)` because we are not able to
get the redelivery count from the message ID.
+> 2. The consumer crashes will trigger the redelivery of the unacked
message, this case will not respect the `NegativeAckRedeliveryBackoff`, which
means the message might get redelivered earlier than the delay time from the
backoff.
Review comment:
```suggestion
> - If a consumer crashes, it triggers the redelivery of unacked messages.
In this case, `NegativeAckRedeliveryBackoff` does not take effect and the
messages might get redelivered earlier than the delay time from the backoff.
```
do you mean this?
--
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]