Package org.apache.kafka.streams.kstream
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 java.lang.ObjectThe window specification interface for fixed size windows that is used to define window boundaries and window maintain duration.If not explicitly specified, the default maintain duration is 1 day. For time semantics, see
TimestampExtractor.- See Also:
TimeWindows,UnlimitedWindows,JoinWindows,SessionWindows,TimestampExtractor
-
-
Field Summary
Fields Modifier and Type Field Description intsegments
-
Constructor Summary
Constructors Modifier Constructor Description protectedWindows()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longmaintainMs()Return the window maintain duration (retention time) in milliseconds.protected Windows<W>segments(int segments)Set the number of segments to be used for rolling the window store.abstract longsize()Return the size of the specified windows in milliseconds.Windows<W>until(long durationMs)Set the window maintain duration (retention time) in milliseconds.abstract java.util.Map<java.lang.Long,W>windowsFor(long timestamp)Create all windows that contain the provided timestamp, indexed by non-negative window start timestamps.
-
-
-
Method Detail
-
until
public Windows<W> until(long durationMs) throws java.lang.IllegalArgumentException
Set the window maintain duration (retention time) in milliseconds. This retention time is a guaranteed lower bound for how long a window will be maintained.- Parameters:
durationMs- the window retention time in milliseconds- Returns:
- itself
- Throws:
java.lang.IllegalArgumentException- ifdurationMsis negative
-
maintainMs
public long maintainMs()
Return the window maintain duration (retention time) in milliseconds.- Returns:
- the window maintain duration
-
segments
protected Windows<W> segments(int segments) throws java.lang.IllegalArgumentException
Set the number of segments to be used for rolling the window store. This function is not exposed to users but can be called by developers that extend this class.- Parameters:
segments- the number of segments to be used- Returns:
- itself
- Throws:
java.lang.IllegalArgumentException- if specified segments is small than 2
-
windowsFor
public abstract java.util.Map<java.lang.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 -> Windowentries
-
size
public abstract long size()
Return the size of the specified windows in milliseconds.- Returns:
- the size of the specified windows
-
-