Offset-Position in der MongoDB wird vor jedem `poll()` aktualisiert
[demos/kafka/training] / src / main / java / de / juplo / kafka / KeyCounter.java
index 147dcd4..1e3cbd2 100644 (file)
@@ -14,11 +14,18 @@ public class KeyCounter
 {
   private final String key;
 
-  private long counter = 0;
+  private long result = 0;
+
+
+  public KeyCounter(String key, long initialValue)
+  {
+    this.key = key;
+    this.result = initialValue;
+  }
 
 
   public long increment()
   {
-    return ++counter;
+    return ++result;
   }
 }