You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2020/03/02 07:22:02 UTC

[pulsar.wiki] branch master updated: Created PIP 58 : Support Consumers Set Custom Retry Delay (markdown)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.wiki.git


The following commit(s) were added to refs/heads/master by this push:
     new d5268ee  Created PIP 58 : Support Consumers  Set Custom Retry Delay (markdown)
d5268ee is described below

commit d5268ee41b71402ea598a645c032ccaf43022eba
Author: Sijie Guo <gu...@gmail.com>
AuthorDate: Sun Mar 1 23:21:58 2020 -0800

    Created PIP 58 : Support Consumers  Set Custom Retry Delay (markdown)
---
 ...-:-Support-Consumers--Set-Custom-Retry-Delay.md | 73 ++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/PIP-58-:-Support-Consumers--Set-Custom-Retry-Delay.md b/PIP-58-:-Support-Consumers--Set-Custom-Retry-Delay.md
new file mode 100644
index 0000000..f81e354
--- /dev/null
+++ b/PIP-58-:-Support-Consumers--Set-Custom-Retry-Delay.md
@@ -0,0 +1,73 @@
+- Status: Proposal
+- Author: Dezhi Liu
+- Pull Request:
+- Mailing List discussion: https://lists.apache.org/thread.html/r5ab7533b6461f29b8ff18e4c51e058226a1b3081fddc5649b234b7fc%40%3Cdev.pulsar.apache.org%3E
+- Release:
+
+## Motivation
+
+For many online business systems, various exceptions usually occur in
+business logic processing, so the message needs to be re-consumed, but
+users hope that this delay time can be controlled flexibly. The current
+user's processing method is usually to send this message to a special retry
+topic because production can specify any delay, so consumers subscribe to the
+business topic and retry topic at the same time. I think this logic can be
+supported by pulsar itself, making it easier for users to use, and it looks
+like this is a very common requirement.
+
+## Proposed changes
+
+This change can be supported on the client side,  need to add a set of
+interfaces to org.apache.pulsar.client.api.Consumer
+
+```java
+void reconsumeLater(Message<?> message, long delayTime, TimeUnit unit)
+throws PulsarClientException;
+CompletableFuture<Void> reconsumeLaterAsync(Message<?> message, long
+delayTime, TimeUnit unit);
+CompletableFuture<Void> reconsumeLaterAsync(Messages<?> messages, int
+delayLevel);
+ CompletableFuture<Void> reconsumeLaterCumulativeAsync(Message<?> message,
+long delayTime, TimeUnit unit);
+```
+
+DeadLetterPolicy add retry topic
+```java
+public class DeadLetterPolicy {
+
+    /**
+     * Maximum number of times that a message will be redelivered before
+being sent to the dead letter queue.
+     */
+    private int maxRedeliverCount;
+
+    /**
+     * Name of the retry topic where the failing messages will be sent.
+     */
+    private String retryLetterTopic;
+
+    /**
+     * Name of the dead topic where the failing messages will be sent.
+     */
+    private String deadLetterTopic;
+
+}
+
+```
+
+org.apache.pulsar.client.impl.ConsumerImpl add a retry producer
+```java
+  private volatile Producer<T> deadLetterProducer;
+
+  private volatile Producer<T> retryLetterProducer;
+```
+
+Can specify whether to enable retry when creating a consumer,default
+is disabled.
+```java
+    @Override
+    public ConsumerBuilder<T> enableRetry(boolean retryEnable) {
+        conf.setRetryEnable(retryEnable);
+        return this;
+    }
+```
\ No newline at end of file