sundar-ka opened a new issue, #24775:
URL: https://github.com/apache/pulsar/issues/24775

   ### Search before reporting
   
   - [x] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### What issue do you find in Pulsar docs?
   
   ### Issue found in Pulsar docs
   
   While reading the examples for **DeadLetterPolicy** and retry/DLQ handling, 
I noticed that the documentation can be misleading about when 
`.enableRetry(true)` is required.
   
   Currently, some examples show configuration of:
   
   - `retryLetterProducerBuilderCustomizer(...)`
   - `retryLetterTopic(...)`
   
   **without** calling `.enableRetry(true)`.
   
   
   ### Example of confusing snippet
   ```java
   // enable batch and disable chunking for the dead letter topic producer
   // by default, the batch feature is disabled and the chunking feature is 
enabled
   DeadLetterProducerBuilderCustomizer producerBuilderCustomizer = (context, 
producerBuilder) -> {
       producerBuilder.enableBatching(true);
       producerBuilder.enableChunking(false);
   };
   Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
                   .topic("my-topic")
                   .subscriptionName("my-subscription")
                   .subscriptionType(SubscriptionType.Shared)
                   .deadLetterPolicy(DeadLetterPolicy.builder()
                         .maxRedeliverCount(maxRedeliveryCount)
                         .deadLetterTopic("my-dead-letter-topic-name")
                         
.deadLetterProducerBuilderCustomizer(producerBuilderCustomizer)
                         
.retryLetterProducerBuilderCustomizer(producerBuilderCustomizer)
                         .build())
                   .subscribe();
   
   
   ### What is your suggestion?
   
   ### Example of suggested snippet
   ```java
   // enable batch and disable chunking for the dead letter topic producer
   // by default, the batch feature is disabled and the chunking feature is 
enabled
   DeadLetterProducerBuilderCustomizer producerBuilderCustomizer = (context, 
producerBuilder) -> {
       producerBuilder.enableBatching(true);
       producerBuilder.enableChunking(false);
   };
   Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
                   .topic("my-topic")
                   .subscriptionName("my-subscription")
                   .subscriptionType(SubscriptionType.Shared)
                   .enableRetry(true)
                   .deadLetterPolicy(DeadLetterPolicy.builder()
                         .maxRedeliverCount(maxRedeliveryCount)
                         .deadLetterTopic("my-dead-letter-topic-name")
                         
.deadLetterProducerBuilderCustomizer(producerBuilderCustomizer)
                         
.retryLetterProducerBuilderCustomizer(producerBuilderCustomizer)
                         .build())
                   .subscribe();
   
   ### Any reference?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
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: commits-unsubscr...@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to