From 43f29cb527d70d04fdc5adbbcfe633a9575b4ec3 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 10 Sep 2022 10:01:31 +0200 Subject: [PATCH] WIP --- src/main/java/de/juplo/kafka/EndlessConsumer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/juplo/kafka/EndlessConsumer.java b/src/main/java/de/juplo/kafka/EndlessConsumer.java index 9edc87b..dfb8349 100644 --- a/src/main/java/de/juplo/kafka/EndlessConsumer.java +++ b/src/main/java/de/juplo/kafka/EndlessConsumer.java @@ -52,22 +52,22 @@ public class EndlessConsumer public void start() { - if (registry.getListenerContainer(id).isChildRunning()) + if (running()) throw new IllegalStateException("Consumer instance " + id + " is already running!"); - log.info("{} - Starting ListenerContainer", id); + log.info("{} - Starting - consumed {} messages before", id, consumed); errorHandler.clearState(); registry.getListenerContainer(id).start(); } public void stop() { - if (!registry.getListenerContainer(id).isChildRunning()) + if (running()) throw new IllegalStateException("Consumer instance " + id + " is not running!"); - log.info("{} - Stopping ListenerContainer", id); + log.info("{} - Stopping", id); registry.getListenerContainer(id).stop(); - log.info("{} - Stopped", id); + log.info("{} - Stopped - consumed {} messages so far", id, consumed); } public boolean running() -- 2.20.1