You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/01 08:01:59 UTC

[GitHub] [pulsar] liudezhi2098 opened a new issue #6448: Support Consumers Set Custom Retry Delay

liudezhi2098 opened a new issue #6448: Support Consumers Set Custom Retry Delay
URL: https://github.com/apache/pulsar/issues/6448
 
 
   ## 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 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);
   ```
   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 unenable
   ```java
       @Override
       public ConsumerBuilder<T> enableRetry(boolean retryEnable) {
           conf.setRetryEnable(retryEnable);
           return this;
       }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [pulsar] liudezhi2098 closed issue #6448: Support Consumers Set Custom Retry Delay

Posted by GitBox <gi...@apache.org>.
liudezhi2098 closed issue #6448: Support Consumers Set Custom Retry Delay
URL: https://github.com/apache/pulsar/issues/6448
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [pulsar] jiazhai commented on issue #6448: Support Consumers Set Custom Retry Delay

Posted by GitBox <gi...@apache.org>.
jiazhai commented on issue #6448: Support Consumers Set Custom Retry Delay
URL: https://github.com/apache/pulsar/issues/6448#issuecomment-593984582
 
 
   Thanks for the great work @liudezhi2098 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services