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 2020/06/16 00:57:58 UTC

[pulsar] branch master updated: [Doc]--Add Retry letter topic (#7257)

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 cecffa3  [Doc]--Add Retry letter topic (#7257)
cecffa3 is described below

commit cecffa3f2a077d6f33aff2ced2a95db5316601ee
Author: HuanliMeng <48...@users.noreply.github.com>
AuthorDate: Tue Jun 16 08:57:41 2020 +0800

    [Doc]--Add Retry letter topic (#7257)
    
    ### Motivation
    This PR is to update doc for the PR: https://github.com/apache/pulsar/pull/6449
    
    Doc contents have been approved by the previous PR  https://github.com/apache/pulsar/pull/7151.
    Because there are two many conflicts in that PR. So I close the original PR and re-create this PR.
    
    
    ### Modifications
    Add retry letter topic in concept> messaging doc.
---
 site2/docs/concepts-messaging.md | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/site2/docs/concepts-messaging.md b/site2/docs/concepts-messaging.md
index 5805971..e45800f 100644
--- a/site2/docs/concepts-messaging.md
+++ b/site2/docs/concepts-messaging.md
@@ -160,6 +160,29 @@ Dead letter topic depends on message re-delivery. Messages are redelivered eithe
 > Note    
 > Currently, dead letter topic is enabled only in the shared subscription mode.
 
+### Retry letter topic
+
+For many online business systems, a message needs to be re-consumed because any exception occurs in the business logic processing. Generally, users hope that they can flexibly configure the delay time for re-consuming the failed messages. In this case, you can configure the producer to send messages to both the business topic and the retry letter topic and you can enable automatic retry on the consumer. When automatic retry is enabled on the consumer, a message is stored in the retry let [...]
+
+By default, automatic retry is disabled. You can set `enableRetry` to `true` to enable automatic retry on the consumer.
+
+This example shows how to consumer messages from a retry letter topic.
+
+```java
+Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
+                .topic(topic)
+                .subscriptionName("my-subscription")
+                .subscriptionType(SubscriptionType.Shared)
+                .enableRetry(true)
+                .receiverQueueSize(100)
+                .deadLetterPolicy(DeadLetterPolicy.builder()
+                        .maxRedeliverCount(maxRedeliveryCount)
+                        .retryLetterTopic("persistent://my-property/my-ns/my-subscription-custom-Retry")
+                        .build())
+                .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
+                .subscribe();
+```
+
 ## Topics
 
 As in other pub-sub systems, topics in Pulsar are named channels for transmitting messages from [producers](reference-terminology.md#producer) to [consumers](reference-terminology.md#consumer). Topic names are URLs that have a well-defined structure: