From 37a2e7de06f3d589861bb094430f287a2e505a7d Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 25 Jun 2024 06:02:34 +0200 Subject: [PATCH] stats: 1.0.0 - Renamed the project into `stats` -- ALIGN --- pom.xml | 8 +++---- .../de/juplo/kafka/wordcount/stats/Entry.java | 2 +- .../de/juplo/kafka/wordcount/stats/Key.java | 2 +- .../juplo/kafka/wordcount/stats/Ranking.java | 2 +- .../wordcount/stats/StatsApplication.java | 6 ++--- .../stats/StatsApplicationConfiguration.java | 20 ++++++++--------- .../stats/StatsApplicationProperties.java | 8 +++---- .../wordcount/stats/StatsController.java | 6 ++--- .../wordcount/stats/StatsStreamProcessor.java | 8 +++---- .../de/juplo/kafka/wordcount/stats/User.java | 2 +- .../kafka/wordcount/stats/UserRanking.java | 2 +- .../wordcount/stats/StatsApplicationIT.java | 22 +++++++++---------- .../StatsStreamProcessorTopologyTest.java | 8 +++---- .../juplo/kafka/wordcount/stats/TestData.java | 4 ++-- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/pom.xml b/pom.xml index 035e095..eef1c95 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ de.juplo.kafka.wordcount - query - 2.1.2 - Wordcount-Query - Query stream-processor of the multi-user wordcount-example + stats + 1.0.0 + Wordcount-Statistics + Statistics stream-processor of the multi-user wordcount-example 21 0.44.0 diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/Entry.java b/src/main/java/de/juplo/kafka/wordcount/stats/Entry.java index 383b1a6..a1aebf2 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/Entry.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/Entry.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.Data; diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/Key.java b/src/main/java/de/juplo/kafka/wordcount/stats/Key.java index a2d85a1..ab88ee6 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/Key.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/Key.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.Data; diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/Ranking.java b/src/main/java/de/juplo/kafka/wordcount/stats/Ranking.java index 8966be6..f9382d9 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/Ranking.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/Ranking.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.Data; diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplication.java b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplication.java index eeee7eb..54ebae4 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplication.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplication.java @@ -1,14 +1,14 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class QueryApplication +public class StatsApplication { public static void main(String[] args) { - SpringApplication.run(QueryApplication.class, args); + SpringApplication.run(StatsApplication.class, args); } } diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationConfiguration.java b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationConfiguration.java index 0f9cad1..9f0699a 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationConfiguration.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -21,20 +21,20 @@ import java.net.Socket; import java.util.Properties; import java.util.concurrent.CompletableFuture; -import static de.juplo.kafka.wordcount.query.QueryStreamProcessor.RANKING_STORE_NAME; -import static de.juplo.kafka.wordcount.query.QueryStreamProcessor.USER_STORE_NAME; +import static de.juplo.kafka.wordcount.stats.StatsStreamProcessor.RANKING_STORE_NAME; +import static de.juplo.kafka.wordcount.stats.StatsStreamProcessor.USER_STORE_NAME; import static org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.SHUTDOWN_CLIENT; @Configuration -@EnableConfigurationProperties(QueryApplicationProperties.class) +@EnableConfigurationProperties(StatsApplicationProperties.class) @Slf4j -public class QueryApplicationConfiguration +public class StatsApplicationConfiguration { @Bean public HostInfo applicationServer( ServerProperties serverProperties, - QueryApplicationProperties applicationProperties) throws IOException + StatsApplicationProperties applicationProperties) throws IOException { String host; if (serverProperties.getAddress() == null) @@ -56,7 +56,7 @@ public class QueryApplicationConfiguration @Bean public Properties streamProcessorProperties( - QueryApplicationProperties applicationProperties, + StatsApplicationProperties applicationProperties, HostInfo applicationServer) { Properties props = new Properties(); @@ -97,15 +97,15 @@ public class QueryApplicationConfiguration } @Bean(initMethod = "start", destroyMethod = "stop") - public QueryStreamProcessor streamProcessor( + public StatsStreamProcessor streamProcessor( Properties streamProcessorProperties, HostInfo applicationServer, - QueryApplicationProperties applicationProperties, + StatsApplicationProperties applicationProperties, KeyValueBytesStoreSupplier userStoreSupplier, KeyValueBytesStoreSupplier rankingStoreSupplier, ConfigurableApplicationContext context) { - QueryStreamProcessor streamProcessor = new QueryStreamProcessor( + StatsStreamProcessor streamProcessor = new StatsStreamProcessor( streamProcessorProperties, applicationServer, applicationProperties.getUsersInputTopic(), diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationProperties.java b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationProperties.java index 4a9eeca..73eddc7 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationProperties.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.Getter; @@ -7,14 +7,14 @@ import lombok.ToString; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties("juplo.wordcount.query") +@ConfigurationProperties("juplo.wordcount.stats") @Getter @Setter @ToString -public class QueryApplicationProperties +public class StatsApplicationProperties { private String bootstrapServer = "localhost:9092"; - private String applicationId = "query"; + private String applicationId = "stats"; private String rankingInputTopic = "top10"; private String usersInputTopic = "users"; private Integer commitInterval; diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/StatsController.java b/src/main/java/de/juplo/kafka/wordcount/stats/StatsController.java index a9b5b80..698e7b4 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/StatsController.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/StatsController.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.RequiredArgsConstructor; import org.apache.kafka.streams.errors.InvalidStateStoreException; @@ -14,9 +14,9 @@ import java.util.Optional; @RestController @RequiredArgsConstructor -public class QueryController +public class StatsController { - private final QueryStreamProcessor processor; + private final StatsStreamProcessor processor; @GetMapping("{username}") ResponseEntity queryFor(@PathVariable String username) diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessor.java b/src/main/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessor.java index 5543a91..c4557ea 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessor.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessor.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; @@ -18,9 +18,9 @@ import java.util.Properties; @Slf4j -public class QueryStreamProcessor +public class StatsStreamProcessor { - public static final String STATS_TYPE = "COUNTER"; + public static final String STATS_TYPE = "POPULAR"; public static final String USER_STORE_NAME = "users"; public static final String RANKING_STORE_NAME = "rankings"; @@ -29,7 +29,7 @@ public class QueryStreamProcessor public final StoreQueryParameters> storeParameters; - public QueryStreamProcessor( + public StatsStreamProcessor( Properties props, HostInfo applicationServer, String usersInputTopic, diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/User.java b/src/main/java/de/juplo/kafka/wordcount/stats/User.java index f62b475..a4a4180 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/User.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/User.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/de/juplo/kafka/wordcount/stats/UserRanking.java b/src/main/java/de/juplo/kafka/wordcount/stats/UserRanking.java index 9ca765a..48babb7 100644 --- a/src/main/java/de/juplo/kafka/wordcount/stats/UserRanking.java +++ b/src/main/java/de/juplo/kafka/wordcount/stats/UserRanking.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import lombok.*; diff --git a/src/test/java/de/juplo/kafka/wordcount/stats/StatsApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/stats/StatsApplicationIT.java index fb12aee..b968743 100644 --- a/src/test/java/de/juplo/kafka/wordcount/stats/StatsApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/stats/StatsApplicationIT.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import com.fasterxml.jackson.databind.ObjectMapper; import de.juplo.kafka.wordcount.top10.TestRanking; @@ -30,8 +30,8 @@ import java.time.Duration; import java.util.Map; import java.util.concurrent.CompletableFuture; -import static de.juplo.kafka.wordcount.query.QueryStreamProcessor.RANKING_STORE_NAME; -import static de.juplo.kafka.wordcount.query.QueryStreamProcessor.USER_STORE_NAME; +import static de.juplo.kafka.wordcount.stats.StatsStreamProcessor.RANKING_STORE_NAME; +import static de.juplo.kafka.wordcount.stats.StatsStreamProcessor.USER_STORE_NAME; import static org.awaitility.Awaitility.await; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -43,15 +43,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. "logging.level.de.juplo=DEBUG", "logging.level.org.apache.kafka.clients=INFO", "logging.level.org.apache.kafka.streams=INFO", - "juplo.wordcount.query.bootstrap-server=${spring.embedded.kafka.brokers}", - "juplo.wordcount.query.commit-interval=100", - "juplo.wordcount.query.cache-max-bytes=0", - "juplo.wordcount.query.users-input-topic=" + QueryApplicationIT.TOPIC_USERS, - "juplo.wordcount.query.ranking-input-topic=" + QueryApplicationIT.TOPIC_TOP10 }) + "juplo.wordcount.stats.bootstrap-server=${spring.embedded.kafka.brokers}", + "juplo.wordcount.stats.commit-interval=100", + "juplo.wordcount.stats.cache-max-bytes=0", + "juplo.wordcount.stats.users-input-topic=" + StatsApplicationIT.TOPIC_USERS, + "juplo.wordcount.stats.ranking-input-topic=" + StatsApplicationIT.TOPIC_TOP10 }) @AutoConfigureMockMvc -@EmbeddedKafka(topics = { QueryApplicationIT.TOPIC_TOP10, QueryApplicationIT.TOPIC_USERS}) +@EmbeddedKafka(topics = { StatsApplicationIT.TOPIC_TOP10, StatsApplicationIT.TOPIC_USERS}) @Slf4j -public class QueryApplicationIT +public class StatsApplicationIT { public static final String TOPIC_TOP10 = "top10"; public static final String TOPIC_USERS = "users"; @@ -62,7 +62,7 @@ public class QueryApplicationIT @Autowired ObjectMapper objectMapper; @Autowired - QueryStreamProcessor streamProcessor; + StatsStreamProcessor streamProcessor; @BeforeAll diff --git a/src/test/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessorTopologyTest.java b/src/test/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessorTopologyTest.java index fbeb19b..54b42f0 100644 --- a/src/test/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessorTopologyTest.java +++ b/src/test/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessorTopologyTest.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import de.juplo.kafka.wordcount.top10.TestRanking; import de.juplo.kafka.wordcount.top10.TestUser; @@ -17,11 +17,11 @@ import org.springframework.kafka.support.serializer.JsonSerializer; import java.util.Map; -import static de.juplo.kafka.wordcount.query.QueryApplicationConfiguration.serializationConfig; +import static de.juplo.kafka.wordcount.stats.StatsApplicationConfiguration.serializationConfig; @Slf4j -public class QueryStreamProcessorTopologyTest +public class StatsStreamProcessorTopologyTest { public static final String TOP10_IN = "TOP10-IN"; public static final String USERS_IN = "USERS-IN"; @@ -37,7 +37,7 @@ public class QueryStreamProcessorTopologyTest @BeforeEach public void setUp() { - Topology topology = QueryStreamProcessor.buildTopology( + Topology topology = StatsStreamProcessor.buildTopology( USERS_IN, TOP10_IN, Stores.inMemoryKeyValueStore(USERS_STORE_NAME), diff --git a/src/test/java/de/juplo/kafka/wordcount/stats/TestData.java b/src/test/java/de/juplo/kafka/wordcount/stats/TestData.java index 44162a0..1603619 100644 --- a/src/test/java/de/juplo/kafka/wordcount/stats/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/stats/TestData.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.query; +package de.juplo.kafka.wordcount.stats; import de.juplo.kafka.wordcount.top10.TestEntry; import de.juplo.kafka.wordcount.top10.TestRanking; @@ -10,7 +10,7 @@ import java.util.Arrays; import java.util.function.Function; import java.util.stream.Stream; -import static de.juplo.kafka.wordcount.query.QueryStreamProcessor.STATS_TYPE; +import static de.juplo.kafka.wordcount.stats.StatsStreamProcessor.STATS_TYPE; import static org.assertj.core.api.Assertions.assertThat; -- 2.20.1