-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
doc-requiredYour PR changes impact docs and you will update later.Your PR changes impact docs and you will update later.
Description
Search before reporting
- I searched in the 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
// 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
// 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();
I wrote pr: apache/pulsar-site#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?
- I'm willing to submit a PR!
Metadata
Metadata
Assignees
Labels
doc-requiredYour PR changes impact docs and you will update later.Your PR changes impact docs and you will update later.