@Override
  public void describe(StreamApplicationDescriptor appDescriptor) {
    KafkaSystemDescriptor trackingSystem = new KafkaSystemDescriptor("tracking");

    KafkaInputDescriptor<PageViewEvent> inputStreamDescriptor =
        trackingSystem.getInputDescriptor("pageViewEvent", new JsonSerdeV2<>(PageViewEvent.class));

    KafkaOutputDescriptor<KV<String, PageViewCount>> outputStreamDescriptor =
        trackingSystem.getOutputDescriptor("pageViewEventPerMember",
            KVSerde.of(new StringSerde(), new JsonSerdeV2<>(PageViewCount.class)));

    appDescriptor.getInputStream(inputStreamDescriptor)
        .window(Windows.<PageViewEvent, String, Integer>keyedTumblingWindow(PageViewEvent::getMemberId, Duration.ofSeconds(10), () -> 0, (m, c) -> c + 1,
            null, null)
            .setEarlyTrigger(Triggers.repeat(Triggers.count(5)))
            .setAccumulationMode(AccumulationMode.DISCARDING), "window1")
        .map(m -> KV.of(m.getKey().getKey(), buildPageViewCount(m)))
        .sendTo(appDescriptor.getOutputStream(outputStreamDescriptor));

    appDescriptor.withMetricsReporterFactories(new HashMap<>());
  }
Example code to implement window-based counter
samza-test/src/main/java/org/apache/samza/example/AppWithGlobalConfigExample.java