From: Kai Moritz Date: Fri, 2 Sep 2022 03:18:23 +0000 (+0200) Subject: Funktionsunabhängiger Name für das erweiterte Interface RebalanceListener X-Git-Tag: sumup-adder---lvm-2-tage~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=0cb776f6a698fda66b655a769827864359f69cb1;p=demos%2Fkafka%2Ftraining Funktionsunabhängiger Name für das erweiterte Interface RebalanceListener --- diff --git a/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java b/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java index b517d35..a751e75 100644 --- a/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java +++ b/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java @@ -13,7 +13,7 @@ import java.util.*; @RequiredArgsConstructor @Slf4j -public class ApplicationRebalanceListener implements PollIntervalAwareConsumerRebalanceListener +public class ApplicationRebalanceListener implements RebalanceListener { private final ApplicationRecordHandler recordHandler; private final AdderResults adderResults; diff --git a/src/main/java/de/juplo/kafka/EndlessConsumer.java b/src/main/java/de/juplo/kafka/EndlessConsumer.java index bdfb9bd..8f5eab3 100644 --- a/src/main/java/de/juplo/kafka/EndlessConsumer.java +++ b/src/main/java/de/juplo/kafka/EndlessConsumer.java @@ -25,7 +25,7 @@ public class EndlessConsumer implements Runnable private final String id; private final String topic; private final Consumer consumer; - private final PollIntervalAwareConsumerRebalanceListener rebalanceListener; + private final RebalanceListener rebalanceListener; private final RecordHandler recordHandler; private final Lock lock = new ReentrantLock(); diff --git a/src/main/java/de/juplo/kafka/PollIntervalAwareConsumerRebalanceListener.java b/src/main/java/de/juplo/kafka/PollIntervalAwareConsumerRebalanceListener.java deleted file mode 100644 index c59418c..0000000 --- a/src/main/java/de/juplo/kafka/PollIntervalAwareConsumerRebalanceListener.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.juplo.kafka; - -import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; - - -public interface PollIntervalAwareConsumerRebalanceListener extends ConsumerRebalanceListener -{ - default void beforeNextPoll() {} - - default void enableCommits() {} - default void disableCommits() {} -} diff --git a/src/main/java/de/juplo/kafka/RebalanceListener.java b/src/main/java/de/juplo/kafka/RebalanceListener.java new file mode 100644 index 0000000..497a111 --- /dev/null +++ b/src/main/java/de/juplo/kafka/RebalanceListener.java @@ -0,0 +1,12 @@ +package de.juplo.kafka; + +import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; + + +public interface RebalanceListener extends ConsumerRebalanceListener +{ + default void beforeNextPoll() {} + + default void enableCommits() {} + default void disableCommits() {} +} diff --git a/src/test/java/de/juplo/kafka/GenericApplicationTests.java b/src/test/java/de/juplo/kafka/GenericApplicationTests.java index ff4a318..a8fa7ea 100644 --- a/src/test/java/de/juplo/kafka/GenericApplicationTests.java +++ b/src/test/java/de/juplo/kafka/GenericApplicationTests.java @@ -68,7 +68,7 @@ abstract class GenericApplicationTests @Autowired MongoProperties mongoProperties; @Autowired - PollIntervalAwareConsumerRebalanceListener rebalanceListener; + RebalanceListener rebalanceListener; @Autowired RecordHandler recordHandler;