import org.springframework.kafka.support.serializer.JsonSerializer;
import java.time.Duration;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
String inputTopic,
String outputTopic,
Properties properties,
- ZoneId zone,
WindowBytesStoreSupplier windowBytesStoreSupplier,
KeyValueBytesStoreSupplier keyValueBytesStoreSupplier)
{
Topology topology = PopularStreamProcessor.buildTopology(
inputTopic,
outputTopic,
- zone,
windowBytesStoreSupplier,
keyValueBytesStoreSupplier);
static Topology buildTopology(
String inputTopic,
String outputTopic,
- ZoneId zone,
WindowBytesStoreSupplier windowBytesStoreSupplier,
KeyValueBytesStoreSupplier keyValueBytesStoreSupplier)
{
.peek((windowedWord, counter) -> log.info("windowed: {} -> {}", windowedWord, counter))
.map((windowedWord, counter) -> new KeyValue<>(
WindowedWord.of(
- ZonedDateTime.ofInstant(windowedWord.window().startTime(), zone),
- ZonedDateTime.ofInstant(windowedWord.window().endTime(), zone),
+ Long.toString(windowedWord.window().startTime().getEpochSecond()),
windowedWord.key().getWord()),
WordCounter.of(windowedWord.key().getWord(), counter)))
.peek((windowedWord, wordCounter) -> log.info("results: {} -> {}", windowedWord, wordCounter))