Aligned the example with the example for a Sliding Window
authorKai Moritz <kai@juplo.de>
Wed, 17 Jul 2024 17:20:38 +0000 (19:20 +0200)
committerKai Moritz <kai@juplo.de>
Wed, 17 Jul 2024 17:20:38 +0000 (19:20 +0200)
* *Note:* Both examples need an explicit configuration for the
  materialization of the state as store, when suppression is activated!

src/test/java/de/juplo/kafka/wordcount/counter/AggregationTopologyTest.java

index 8b64042..3dfd235 100644 (file)
@@ -23,6 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 @Slf4j
 public class AggregationTopologyTest
 {
+  static final String STORE_NAME = "aggregate-store";
   static final Duration INACTIVITY_GAP = Duration.ofSeconds(2);
   static final SessionWindows WINDOWS = SessionWindows.ofInactivityGapWithNoGrace(INACTIVITY_GAP);
 
@@ -39,7 +40,7 @@ public class AggregationTopologyTest
         .windowedBy(WINDOWS)
         .reduce(
             (aggregate, value) -> aggregate + "-" + value,
-            Materialized.<String, String, SessionStore<Bytes, byte[]>>as("aggregated-store")
+            Materialized.<String, String, SessionStore<Bytes, byte[]>>as(STORE_NAME)
                 .withKeySerde(Serdes.String())
                 .withValueSerde(Serdes.String()))
         .suppress(Suppressed.untilWindowCloses(Suppressed.BufferConfig.unbounded()))