stats: 1.0.0 - Renamed the project into `stats` -- ALIGN
authorKai Moritz <kai@juplo.de>
Tue, 25 Jun 2024 04:02:34 +0000 (06:02 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 25 Jun 2024 16:34:06 +0000 (18:34 +0200)
14 files changed:
pom.xml
src/main/java/de/juplo/kafka/wordcount/stats/Entry.java
src/main/java/de/juplo/kafka/wordcount/stats/Key.java
src/main/java/de/juplo/kafka/wordcount/stats/Ranking.java
src/main/java/de/juplo/kafka/wordcount/stats/StatsApplication.java
src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationConfiguration.java
src/main/java/de/juplo/kafka/wordcount/stats/StatsApplicationProperties.java
src/main/java/de/juplo/kafka/wordcount/stats/StatsController.java
src/main/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessor.java
src/main/java/de/juplo/kafka/wordcount/stats/User.java
src/main/java/de/juplo/kafka/wordcount/stats/UserRanking.java
src/test/java/de/juplo/kafka/wordcount/stats/StatsApplicationIT.java
src/test/java/de/juplo/kafka/wordcount/stats/StatsStreamProcessorTopologyTest.java
src/test/java/de/juplo/kafka/wordcount/stats/TestData.java

diff --git a/pom.xml b/pom.xml
index 035e095..eef1c95 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -9,10 +9,10 @@
                <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>de.juplo.kafka.wordcount</groupId>
-       <artifactId>query</artifactId>
-       <version>2.1.2</version>
-       <name>Wordcount-Query</name>
-       <description>Query stream-processor of the multi-user wordcount-example</description>
+       <artifactId>stats</artifactId>
+       <version>1.0.0</version>
+       <name>Wordcount-Statistics</name>
+       <description>Statistics stream-processor of the multi-user wordcount-example</description>
        <properties>
                <java.version>21</java.version>
                <docker-maven-plugin.version>0.44.0</docker-maven-plugin.version>
index 383b1a6..a1aebf2 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.wordcount.query;
+package de.juplo.kafka.wordcount.stats;
 
 import lombok.Data;
 
index a2d85a1..ab88ee6 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.wordcount.query;
+package de.juplo.kafka.wordcount.stats;
 
 import lombok.Data;
 
index 8966be6..f9382d9 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.wordcount.query;
+package de.juplo.kafka.wordcount.stats;
 
 import lombok.Data;
 
index eeee7eb..54ebae4 100644 (file)
@@ -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);
        }
 }
index 0f9cad1..9f0699a 100644 (file)
@@ -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(),
index 4a9eeca..73eddc7 100644 (file)
@@ -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;
index a9b5b80..698e7b4 100644 (file)
@@ -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<UserRanking> queryFor(@PathVariable String username)
index 5543a91..c4557ea 100644 (file)
@@ -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<ReadOnlyKeyValueStore<String, UserRanking>> storeParameters;
 
 
-       public QueryStreamProcessor(
+       public StatsStreamProcessor(
                        Properties props,
                        HostInfo applicationServer,
                        String usersInputTopic,
index f62b475..a4a4180 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.wordcount.query;
+package de.juplo.kafka.wordcount.stats;
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;
index fb12aee..b968743 100644 (file)
@@ -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
index fbeb19b..54b42f0 100644 (file)
@@ -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),
index 44162a0..1603619 100644 (file)
@@ -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;