You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2020/02/14 12:08:47 UTC

[rocketmq] branch develop updated: min value for autoCommitIntervalMillis. #1774 (#1775)

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

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 35c3888  min value for autoCommitIntervalMillis.   #1774 (#1775)
35c3888 is described below

commit 35c38888e0d5678fb4aaad5ba8534b7552d9a9a0
Author: uglycow <xi...@gmail.com>
AuthorDate: Fri Feb 14 20:08:32 2020 +0800

    min value for autoCommitIntervalMillis.   #1774 (#1775)
    
    * typo fix
    
    * add MessageExt.getBrokerName()
    
    * add brokerName for toString
    
    * get brokerName  from mq
    
    * min value for autoCommitInterval
    
    * use constant variable
---
 .../apache/rocketmq/client/consumer/DefaultLitePullConsumer.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
index bfef761..ef76cfd 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
@@ -95,6 +95,11 @@ public class DefaultLitePullConsumer extends ClientConfig implements LitePullCon
     private int pullThreadNums = 20;
 
     /**
+     * Minimum commit offset interval time in milliseconds.
+     */
+    private static final long MIN_AUTOCOMMIT_INTERVAL_MILLIS = 1000;
+
+    /**
      * Maximum commit offset interval time in milliseconds.
      */
     private long autoCommitIntervalMillis = 5 * 1000;
@@ -315,7 +320,9 @@ public class DefaultLitePullConsumer extends ClientConfig implements LitePullCon
     }
 
     public void setAutoCommitIntervalMillis(long autoCommitIntervalMillis) {
-        this.autoCommitIntervalMillis = autoCommitIntervalMillis;
+        if (autoCommitIntervalMillis >= MIN_AUTOCOMMIT_INTERVAL_MILLIS) {
+            this.autoCommitIntervalMillis = autoCommitIntervalMillis;
+        }
     }
 
     public int getPullBatchSize() {