public class WatermarkTimeEvictionPolicy<T> extends TimeEvictionPolicy<T>
An eviction policy that evicts events based on time duration taking watermark time and event lag into account.
EvictionPolicy.Action
evictionContext
Constructor and Description |
---|
WatermarkTimeEvictionPolicy(int windowLength)
Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.
|
WatermarkTimeEvictionPolicy(int windowLength,
int lag)
Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.
|
Modifier and Type | Method and Description |
---|---|
EvictionPolicy.Action |
evict(Event<T> event)
Decides if an event should be expired from the window, processed in the current window or kept for later processing.
|
String |
toString() |
getContext, getState, reset, restoreState, setContext, track
public WatermarkTimeEvictionPolicy(int windowLength)
Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.
windowLength
- the window length in millisecondspublic WatermarkTimeEvictionPolicy(int windowLength, int lag)
Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis. The lag parameter can be used in the case of event based ts to break the queue scan early.
windowLength
- the window length in millisecondslag
- the max event lag in millisecondspublic EvictionPolicy.Action evict(Event<T> event)
Decides if an event should be expired from the window, processed in the current window or kept for later processing.
Keeps events with future ts in the queue for processing in the next window. If the ts difference is more than the lag, stops scanning the queue for the current window.evict
in interface EvictionPolicy<T,EvictionContext>
evict
in class TimeEvictionPolicy<T>
event
- the input eventEvictionPolicy.Action
to be taken based on the input eventpublic String toString()
toString
in class TimeEvictionPolicy<T>
Copyright © 2020 The Apache Software Foundation. All rights reserved.