Class Windows<W extends Window>

java.lang.Object
org.apache.kafka.streams.kstream.Windows<W>
Type Parameters:
W - type of the window instance
Direct Known Subclasses:
JoinWindows, TimeWindows, UnlimitedWindows

public abstract class Windows<W extends Window> extends Object
The window specification for fixed size windows that is used to define window boundaries and grace period.

Grace period defines how long to wait on out-of-order events. That is, windows will continue to accept new records until stream_time >= window_end + grace_period. Records that arrive after the grace period passed are considered late and will not be processed but are dropped.

Warning: It may be unsafe to use objects of this class in set- or map-like collections, since the equals and hashCode methods depend on mutable fields.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final long
    By default grace period is 24 hours for all windows in other words we allow out-of-order data for up to a day This behavior is now deprecated and additional details are available in the motivation for the KIP Check out KIP-633 for more details
    protected static final long
    This constant is used as the specified grace period where we do not have any grace periods instead of magic constants
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract long
    Return the window grace period (the time to admit out-of-order events after the end of the window.) Delay is defined as (stream_time - record_timestamp).
    abstract long
    Return the size of the specified windows in milliseconds.
    abstract Map<Long,W>
    windowsFor(long timestamp)
    Create all windows that contain the provided timestamp, indexed by non-negative window start timestamps.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEPRECATED_DEFAULT_24_HR_GRACE_PERIOD

      protected static final long DEPRECATED_DEFAULT_24_HR_GRACE_PERIOD
      By default grace period is 24 hours for all windows in other words we allow out-of-order data for up to a day This behavior is now deprecated and additional details are available in the motivation for the KIP Check out KIP-633 for more details
      See Also:
    • NO_GRACE_PERIOD

      protected static final long NO_GRACE_PERIOD
      This constant is used as the specified grace period where we do not have any grace periods instead of magic constants
      See Also:
  • Constructor Details

    • Windows

      protected Windows()
  • Method Details

    • windowsFor

      public abstract Map<Long,W> windowsFor(long timestamp)
      Create all windows that contain the provided timestamp, indexed by non-negative window start timestamps.
      Parameters:
      timestamp - the timestamp window should get created for
      Returns:
      a map of windowStartTimestamp -> Window entries
    • size

      public abstract long size()
      Return the size of the specified windows in milliseconds.
      Returns:
      the size of the specified windows
    • gracePeriodMs

      public abstract long gracePeriodMs()
      Return the window grace period (the time to admit out-of-order events after the end of the window.) Delay is defined as (stream_time - record_timestamp).