From 31dc17e7f5ac937f21882ec28b3234c5c398e840 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 9 Apr 2022 13:21:43 +0200 Subject: [PATCH] =?utf8?q?Refaktorisierung=20f=C3=BCr=20Tests=20-=20Execut?= =?utf8?q?orService=20als=20separate=20Bean=20erzeugt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/de/juplo/kafka/ApplicationConfiguration.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 58f44fa..76d0c8a 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Properties; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -18,16 +19,23 @@ public class ApplicationConfiguration @Bean public EndlessConsumer endlessConsumer( KafkaConsumer kafkaConsumer, + ExecutorService executor, ApplicationProperties properties) { return new EndlessConsumer( - Executors.newFixedThreadPool(1), + executor, properties.getClientId(), properties.getTopic(), kafkaConsumer); } + @Bean + public ExecutorService executor() + { + return Executors.newSingleThreadExecutor(); + } + @Bean(destroyMethod = "close") public KafkaConsumer kafkaConsumer(ApplicationProperties properties) { -- 2.20.1