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

    KafkaInputDescriptor<PageViewEvent> inputStreamDescriptor =
        trackingSystem.getInputDescriptor("pageViewEvent", new JsonSerdeV2<>(PageViewEvent.class));
    KafkaOutputDescriptor<Integer> outputStreamDescriptor =
        trackingSystem.getOutputDescriptor("pageViewEventPerMember", new IntegerSerde());

    SupplierFunction<Integer> initialValue = () -> 0;
    FoldLeftFunction<PageViewEvent, Integer> counter = (m, c) -> c == null ? 1 : c + 1;
    MessageStream<PageViewEvent> inputStream = appDescriptor.getInputStream(inputStreamDescriptor);
    OutputStream<Integer> outputStream = appDescriptor.getOutputStream(outputStreamDescriptor);

    // create a tumbling window that outputs the number of message collected every 10 minutes.
    // also emit early results if either the number of messages collected reaches 30000, or if no new messages arrive
    // for 1 minute.
    inputStream
        .window(Windows.tumblingWindow(Duration.ofMinutes(10), initialValue, counter, new IntegerSerde())
            .setLateTrigger(Triggers.any(Triggers.count(30000),
                Triggers.timeSinceLastMessage(Duration.ofMinutes(1)))), "window")
        .map(WindowPane::getMessage)
        .sendTo(outputStream);
  }
Example implementation of a simple user-defined task w/ a window operator.
samza-test/src/main/java/org/apache/samza/example/WindowExample.java