From b6504e8d9a1fc4a5ff29ee84cd76cf51b0d8e62e Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 9 Jun 2024 10:07:49 +0200 Subject: [PATCH] query: 1.0.6 - Refined `QueryAppilcationConfiguration` -- separated detection of correct `HostInfo` into a separate ``@Bean``-method --- .../query/QueryApplicationConfiguration.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 c7aa03f..88b14f0 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 usersStreamProcessor( + 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,18 @@ public class QueryApplicationConfiguration Integer port = serverProperties.getPort() == null ? 8080 : serverProperties.getPort(); + return new HostInfo(host, port); + } + + public QueryStreamProcessor usersStreamProcessor( + QueryApplicationProperties applicationProperties, + HostInfo applicationServer, + ObjectMapper mapper, + ConfigurableApplicationContext context) throws IOException + { return new QueryStreamProcessor( applicationProperties.getApplicationId(), - new HostInfo(host, port), + applicationServer, applicationProperties.getBootstrapServer(), applicationProperties.getUsersInputTopic(), applicationProperties.getRankingInputTopic(), -- 2.20.1