Based on this example (https://github.com/confluentinc/kafka-streams-examples/blob/5.5.0-post/src/test/java/io/confluent/examples/streams/window/DailyTimeWindows.java), I would like to create a Monthly time windows. The problem is the size method which I don't know the size since every month have a different size.
For more context, I want to count each unique user who made a transaction over a month based on userId.
Actual implementation for windowsFor method:
public Map<Long, TimeWindow> windowsFor(final long timestamp) {
final Instant instant = Instant.ofEpochMilli(timestamp);
final ZonedDateTime zonedDateTime = instant.atZone(this.zoneId);
final ZonedDateTime startTime = zonedDateTime.truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1);
final ZonedDateTime endTime = startTime.plusMonths(1);
final Map<Long, TimeWindow> windows = new LinkedHashMap<>();
windows.put(toEpochMilli(startTime), new TimeWindow(toEpochMilli(startTime), toEpochMilli(endTime)));
return windows;
}
Is someone have an idea?