From: Kai Moritz Date: Sun, 9 Jun 2024 08:07:49 +0000 (+0200) Subject: query: 1.0.6 - Refined `QueryAppilcationConfiguration` X-Git-Tag: query-with-kafkaproducer~19 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=861c055cbdc7fe36fb924c5b694537df8eb06423;p=demos%2Fkafka%2Fwordcount query: 1.0.6 - Refined `QueryAppilcationConfiguration` -- separated detection of correct `HostInfo` into a separate ``@Bean``-method --- diff --git a/src/main/java/de/juplo/kafka/wordcount/query/QueryApplicationConfiguration.java b/src/main/java/de/juplo/kafka/wordcount/query/QueryApplicationConfiguration.java index 9f6769f..3f866f0 100644 --- a/src/main/java/de/juplo/kafka/wordcount/query/QueryApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/wordcount/query/QueryApplicationConfiguration.java @@ -18,11 +18,9 @@ import java.net.Socket; public class QueryApplicationConfiguration { @Bean - public QueryStreamProcessor streamProcessor( + public HostInfo applicationServer( ServerProperties serverProperties, - QueryApplicationProperties applicationProperties, - ObjectMapper mapper, - ConfigurableApplicationContext context) throws IOException + QueryApplicationProperties applicationProperties) throws IOException { String host; if (serverProperties.getAddress() == null) @@ -39,9 +37,19 @@ public class QueryApplicationConfiguration Integer port = serverProperties.getPort() == null ? 8080 : serverProperties.getPort(); + return new HostInfo(host, port); + } + + @Bean + public QueryStreamProcessor streamProcessor( + QueryApplicationProperties applicationProperties, + HostInfo applicationServer, + ObjectMapper mapper, + ConfigurableApplicationContext context) + { return new QueryStreamProcessor( applicationProperties.getApplicationId(), - new HostInfo(host, port), + applicationServer, applicationProperties.getBootstrapServer(), applicationProperties.getUsersInputTopic(), applicationProperties.getRankingInputTopic(),