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 2021/11/01 12:10:29 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #12566: Add negative ack redelivery backoff.

codelipenghui commented on a change in pull request #12566:
URL: https://github.com/apache/pulsar/pull/12566#discussion_r740163406



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -514,10 +514,10 @@ public void reconsumeLaterCumulative(Message<?> message, long delayTime, TimeUni
         return doAcknowledgeWithTxn(messageId, AckType.Cumulative, Collections.emptyMap(), txnImpl);
     }
 
-    @Override
-    public void negativeAcknowledge(Message<?> message) {
-        negativeAcknowledge(message.getMessageId());
-    }
+//    @Override
+//    public void negativeAcknowledge(Message<?> message) {
+//        negativeAcknowledge(message.getMessageId());
+//    }

Review comment:
       Typo here?

##########
File path: pulsar-client-api/src/main/java/org/apache/pulsar/client/api/NegativeAckRedeliveryBackoff.java
##########
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.client.api;
+
+import java.io.Serializable;
+import org.apache.pulsar.common.classification.InterfaceAudience;
+import org.apache.pulsar.common.classification.InterfaceStability;
+
+/**
+ * Interface for custom message is negativeAcked policy, users can specify a {@link NegativeAckRedeliveryBackoff} for
+ * a consumer.
+ *
+ * Notice: the consumer crashes will trigger the redelivery of the unacked message, this case will not respect the
+ * {@link NegativeAckRedeliveryBackoff}, which means the message might get redelivered earlier than the delay time
+ * from the backoff.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Stable
+public interface NegativeAckRedeliveryBackoff extends Serializable  {
+    /**
+     * @param redeliveryCount indicates the number of times the message was redelivered
+     */
+    long next(int redeliveryCount);
+
+    long getMinNackTimeMs();
+
+    long getMaxNackTimeMs();

Review comment:
       I think we don't need these 2 methods for the `NegativeAckRedeliveryBackoff` interface, it should only for the implementations?

##########
File path: pulsar-client-api/src/main/java/org/apache/pulsar/client/api/NegativeAckRedeliveryBackoff.java
##########
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.client.api;
+
+import java.io.Serializable;
+import org.apache.pulsar.common.classification.InterfaceAudience;
+import org.apache.pulsar.common.classification.InterfaceStability;
+
+/**
+ * Interface for custom message is negativeAcked policy, users can specify a {@link NegativeAckRedeliveryBackoff} for
+ * a consumer.
+ *
+ * Notice: the consumer crashes will trigger the redelivery of the unacked message, this case will not respect the
+ * {@link NegativeAckRedeliveryBackoff}, which means the message might get redelivered earlier than the delay time
+ * from the backoff.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Stable
+public interface NegativeAckRedeliveryBackoff extends Serializable  {
+    /**
+     * @param redeliveryCount indicates the number of times the message was redelivered
+     */
+    long next(int redeliveryCount);
+
+    long getMinNackTimeMs();
+
+    long getMaxNackTimeMs();
+
+    interface Builder {

Review comment:
       Should provide in the implementations not the interface?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org