You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2019/08/26 01:47:26 UTC
[pulsar] branch master updated: Clarification in DLQ documentation
(#5029)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new ff41871 Clarification in DLQ documentation (#5029)
ff41871 is described below
commit ff418717dd30f001cbd579c4fa1038a96fa894bb
Author: Chris Bartholomew <ch...@kafkaesque.io>
AuthorDate: Sun Aug 25 21:47:19 2019 -0400
Clarification in DLQ documentation (#5029)
Clarification in DLQ documentation.
---
site2/docs/concepts-messaging.md | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/site2/docs/concepts-messaging.md b/site2/docs/concepts-messaging.md
index 0498324..7aca284 100644
--- a/site2/docs/concepts-messaging.md
+++ b/site2/docs/concepts-messaging.md
@@ -100,7 +100,7 @@ When a message is not consumed successfully, and you want to trigger the broker
Dead letter topic enables you to consume new messages when some messages cannot be consumed successfully by a consumer. In this mechanism, messages that are failed to be consumed are stored in a separate topic, which is called dead letter topic. You can decide how to handle messages in the dead letter topic.
-The following example shows how to enable dead letter topic in Java client.
+The following example shows how to enable dead letter topic in a Java client using the default dead letter topic:
```java
Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
@@ -113,7 +113,28 @@ Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
.subscribe();
```
-Dead letter topic depends on message re-delivery. You need to confirm message re-delivery method: negative acknowledgement or acknowledgement timeout. Use negative acknowledgement prior to acknowledgement timeout.
+The default dead letter topic uses this format:
+```
+<topicname>-<subscriptionname>-DLQ
+```
+
+If you want to specify the name of the dead letter topic, use this Java client example:
+
+```java
+Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
+ .topic(topic)
+ .subscriptionName("my-subscription")
+ .subscriptionType(SubscriptionType.Shared)
+ .deadLetterPolicy(DeadLetterPolicy.builder()
+ .maxRedeliverCount(maxRedeliveryCount)
+ .deadLetterTopic("your-topic-name")
+ .build())
+ .subscribe();
+
+```
+
+
+Dead letter topic depends on message re-delivery. Messages are redelivered either due to [acknowledgement timeout](#acknowledgement-timeout) or [negative acknowledgement](#negative-acknowledgement). If you are going to use negative acknowledgement on a message, make sure it is negatively acknowledged before the acknowledgement timeout.
> Note
> Currently, dead letter topic is enabled only in the shared subscription mode.