rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duhengfore...@apache.org
Subject [rocketmq] branch develop updated: min value for autoCommitIntervalMillis. #1774 (#1775)
Date Fri, 14 Feb 2020 12:08:47 GMT
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 <xieyuneng@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() {


Mime
View raw message