import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.*;
-import org.apache.kafka.streams.kstream.*;
+import org.apache.kafka.streams.kstream.KStream;
+import org.apache.kafka.streams.kstream.TimeWindows;
+import org.apache.kafka.streams.kstream.Window;
+import org.apache.kafka.streams.kstream.Windowed;
import org.apache.kafka.streams.kstream.internals.TimeWindow;
import org.apache.kafka.streams.test.TestRecord;
import org.junit.jupiter.api.Test;
KStream<String, String> input = builder.stream(INPUT);
input
- .peek((k,v) -> log.info("peek-0 -- {} = {}", k, v))
.groupByKey()
.windowedBy(WINDOWS)
.reduce((aggregate, value) -> aggregate + "-" + value)
.toStream((k,v) -> k.toString())
- .peek((k,v) -> log.info("peek-1 -- {} = {}", k, v))
.to(OUTPUT);
Topology topology = builder.build();