popular: 1.1.0 - Implemented supression of intermediate results popular-1.1.0
authorKai Moritz <kai@juplo.de>
Mon, 17 Jun 2024 20:45:34 +0000 (22:45 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 20 Jun 2024 19:30:54 +0000 (21:30 +0200)
src/main/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessor.java

index 788ae20..9bcf0f7 100644 (file)
@@ -3,10 +3,7 @@ package de.juplo.kafka.wordcount.popular;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.common.serialization.Serdes;
 import org.apache.kafka.streams.*;
-import org.apache.kafka.streams.kstream.Consumed;
-import org.apache.kafka.streams.kstream.Materialized;
-import org.apache.kafka.streams.kstream.Produced;
-import org.apache.kafka.streams.kstream.TimeWindows;
+import org.apache.kafka.streams.kstream.*;
 import org.apache.kafka.streams.state.KeyValueBytesStoreSupplier;
 import org.apache.kafka.streams.state.QueryableStoreTypes;
 import org.apache.kafka.streams.state.ReadOnlyKeyValueStore;
@@ -72,6 +69,7 @@ public class PopularStreamProcessor
                                                                .<Word, Long>as(windowBytesStoreSupplier)
                                                                .withKeySerde(new JsonSerde<>(Word.class).noTypeInfo())
                                                                .withValueSerde(Serdes.Long()))
+                               .suppress(Suppressed.untilWindowCloses(Suppressed.BufferConfig.unbounded()))
                                .toStream()
                                .peek((windowedWord, counter) -> log.info("windowed: {} -> {}", windowedWord, counter))
                                .map((windowedWord, counter) -> new KeyValue<>(