Rückbau auf einen Consumer, der in `onPartitionsRevoked()` immer committed
[demos/kafka/training] / src / main / java / de / juplo / kafka / EndlessConsumer.java
index 0238521..f0e74d3 100644 (file)
@@ -25,7 +25,7 @@ public class EndlessConsumer<K, V> implements Runnable
   private final String id;
   private final String topic;
   private final Consumer<K, V> consumer;
-  private final PollIntervalAwareConsumerRebalanceListener rebalanceListener;
+  private final ConsumerRebalanceListener rebalanceListener;
   private final RecordHandler<K, V> recordHandler;
 
   private final Lock lock = new ReentrantLock();
@@ -67,14 +67,11 @@ public class EndlessConsumer<K, V> implements Runnable
 
           consumed++;
         }
-
-        rebalanceListener.beforeNextPoll();
       }
     }
     catch(WakeupException e)
     {
-      log.info("{} - RIIING! Request to stop consumption - commiting current offsets!", id);
-      consumer.commitSync();
+      log.info("{} - RIIING! Request to stop consumption.", id);
       shutdown();
     }
     catch(RecordDeserializationException e)
@@ -88,7 +85,6 @@ public class EndlessConsumer<K, V> implements Runnable
           offset,
           e.getCause().toString());
 
-      consumer.commitSync();
       shutdown(e);
     }
     catch(Exception e)