From 3c459370a7995058e945494fdbefc66b8b028c30 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 29 Sep 2024 09:55:21 +0200 Subject: [PATCH] Einheitliche Benennung des Consumers -- ALIGN --- src/main/java/de/juplo/kafka/Application.java | 16 ++++++++-------- .../de/juplo/kafka/ApplicationConfiguration.java | 4 ++-- .../java/de/juplo/kafka/ExampleConsumer.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/juplo/kafka/Application.java b/src/main/java/de/juplo/kafka/Application.java index 04dc343..be152fa 100644 --- a/src/main/java/de/juplo/kafka/Application.java +++ b/src/main/java/de/juplo/kafka/Application.java @@ -24,7 +24,7 @@ public class Application implements ApplicationRunner @Autowired Consumer kafkaConsumer; @Autowired - SimpleConsumer simpleConsumer; + ExampleConsumer exampleConsumer; @Autowired ConfigurableApplicationContext context; @@ -33,17 +33,17 @@ public class Application implements ApplicationRunner @Override public void run(ApplicationArguments args) throws Exception { - log.info("Starting SimpleConsumer"); - consumerJob = taskExecutor.submitListenable(simpleConsumer); + log.info("Starting ExampleConsumer"); + consumerJob = taskExecutor.submitListenable(exampleConsumer); consumerJob.addCallback( exitStatus -> { - log.info("SimpleConsumer exited normally, exit-status: {}", exitStatus); + log.info("ExampleConsumer exited normally, exit-status: {}", exitStatus); SpringApplication.exit(context, () -> exitStatus); }, t -> { - log.error("SimpleConsumer exited abnormally!", t); + log.error("ExampleConsumer exited abnormally!", t); SpringApplication.exit(context, () -> 2); }); } @@ -51,11 +51,11 @@ public class Application implements ApplicationRunner @PreDestroy public void shutdown() throws ExecutionException, InterruptedException { - log.info("Signaling SimpleConsumer to quit its work"); + log.info("Signaling ExampleConsumer to quit its work"); kafkaConsumer.wakeup(); - log.info("Waiting for SimpleConsumer to finish its work"); + log.info("Waiting for ExampleConsumer to finish its work"); consumerJob.get(); - log.info("SimpleConsumer finished its work"); + log.info("ExampleConsumer finished its work"); } diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 9a237b7..a31c256 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -14,13 +14,13 @@ import org.springframework.kafka.core.ConsumerFactory; public class ApplicationConfiguration { @Bean - public SimpleConsumer simpleConsumer( + public ExampleConsumer exampleConsumer( Consumer kafkaConsumer, KafkaProperties kafkaProperties, ApplicationProperties applicationProperties) { return - new SimpleConsumer( + new ExampleConsumer( kafkaProperties.getClientId(), applicationProperties.getTopics(), kafkaConsumer); diff --git a/src/main/java/de/juplo/kafka/ExampleConsumer.java b/src/main/java/de/juplo/kafka/ExampleConsumer.java index a76132b..dd43b11 100644 --- a/src/main/java/de/juplo/kafka/ExampleConsumer.java +++ b/src/main/java/de/juplo/kafka/ExampleConsumer.java @@ -14,7 +14,7 @@ import java.util.concurrent.Callable; @Slf4j @RequiredArgsConstructor -public class SimpleConsumer implements Callable +public class ExampleConsumer implements Callable { private final String id; private final String[] topics; -- 2.20.1