Skip to content

Instantly share code, notes, and snippets.

@krolen
krolen / FinishingCountTrigger.java
Created April 23, 2016 14:55
Flink - counting trigger that correctly flushes all windows
public class FinishingCountTrigger<W extends Window> extends Trigger<Object, W> {
private static final long serialVersionUID = 1L;
private final long maxCount;
private final ValueStateDescriptor<Long> stateDesc = new ValueStateDescriptor<>("count", LongSerializer.INSTANCE, 0L);
public FinishingCountTrigger(long maxCount) {
this.maxCount = maxCount;
}
public class MyFinishTrigger<T, W extends Window> extends Trigger<T, W> {
private static final long serialVersionUID = 1L;
private Trigger<T, W> nestedTrigger;
private MyFinishTrigger(Trigger<T, W> nestedTrigger) {
this.nestedTrigger = nestedTrigger;
}
@Override