From a2445f04436bb1087c9fbcd44d319496e91a90c8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 14 Aug 2022 18:25:54 +0200 Subject: [PATCH] fix: In `onPartitionsAssigned()` wurde der Kafka-Offset ausgegeben --- src/main/java/de/juplo/kafka/AdderRebalanceListener.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/juplo/kafka/AdderRebalanceListener.java b/src/main/java/de/juplo/kafka/AdderRebalanceListener.java index 7526929..ef595ba 100644 --- a/src/main/java/de/juplo/kafka/AdderRebalanceListener.java +++ b/src/main/java/de/juplo/kafka/AdderRebalanceListener.java @@ -32,12 +32,11 @@ public class AdderRebalanceListener implements PollIntervalAwareConsumerRebalanc partitions.forEach(tp -> { Integer partition = tp.partition(); - Long offset = consumer.position(tp); - log.info("{} - adding partition: {}, offset={}", id, partition, offset); StateDocument document = repository .findById(Integer.toString(partition)) .orElse(new StateDocument(partition)); + log.info("{} - adding partition: {}, offset={}", id, partition, document.offset); if (document.offset >= 0) { // Only seek, if a stored offset was found @@ -54,15 +53,15 @@ public class AdderRebalanceListener implements PollIntervalAwareConsumerRebalanc partitions.forEach(tp -> { Integer partition = tp.partition(); - Long newOffset = consumer.position(tp); + Long offset = consumer.position(tp); log.info( "{} - removing partition: {}, offset of next message {})", id, partition, - newOffset); + offset); if (commitsEnabled) { - repository.save(new StateDocument(partition, handler.removePartition(partition), newOffset)); + repository.save(new StateDocument(partition, handler.removePartition(partition), offset)); } else { -- 2.20.1