Kafka Windowing Streams Junk Data With Windowed Ktable Serdes

63 Views Asked by At

I am working on a Kafka Streaming Dashboard where I need count of daily data of last 24 hours

stream.groupByKey() .windowedBy(TimeWindows.of(Duration.ofHours(24)).grace(Duration.ofMinutes(5))) .aggregate(() -> "0",(key, value, aggregate) -> value,Materialized.with(Serdes.String(), Serdes.String())).suppress(untilWindowCloses(unbounded())) .toStream().to("Test_windowing1");

In Above code I am trying to view data with of past 24 hours with windowing but the output before streaming with windowing and after are

Before Windowing

Key: 2023010612 Value: {"Title":"HOURLY_COUNT","Count":"19967","Key":"2023010612"}

After Windowing

Key: 2023010612���� Value: {"Title":"HOURLY_COUNT","Count":"19967","Key":"2023010612"}

I want to delete the past 2 days data with windowing and have same result for the key after windowing as well

Thank you in Advance

0

There are 0 best solutions below