[Doc] Pulsar consumer config is missing to enable retry while mentioning retryletter config
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### 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 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 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();
```
I wrote pr: https://github.com/apache/pulsar-site/pull/1041
I'm new to using pulsar. Kindly take a look and feel free to give me advice.
### Any reference?
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
Research direction
Start with the Pulsar documentation examples for DeadLetterPolicy and retry/DLQ handling, especially the snippet using retryLetterProducerBuilderCustomizer and retryLetterTopic. Update the relevant example so retry configuration includes enableRetry(true), then check the surrounding examples for consistent guidance and verify the rendered documentation; an associated pull request is already mentioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100