Java Code Examples for org.apache.flink.streaming.api.windowing.windows.TimeWindow#maxTimestamp()

The following examples show how to use org.apache.flink.streaming.api.windowing.windows.TimeWindow#maxTimestamp() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventTimeTrigger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 2
Source File: WindowOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 3
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the watermark is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the watermark is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentWatermark()) {
		ctx.registerEventTimeTimer(windowMaxTimestamp);
	}
}
 
Example 4
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 5
Source File: ProcessingTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the time is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the time is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentProcessingTime()) {
		ctx.registerProcessingTimeTimer(windowMaxTimestamp);
	}
}
 
Example 6
Source File: WindowOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 7
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the watermark is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the watermark is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentWatermark()) {
		ctx.registerEventTimeTimer(windowMaxTimestamp);
	}
}
 
Example 8
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 9
Source File: ProcessingTimeTrigger.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the time is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the time is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentProcessingTime()) {
		ctx.registerProcessingTimeTimer(windowMaxTimestamp);
	}
}
 
Example 10
Source File: WindowOperatorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception {
	if (window.maxTimestamp() <= ctx.getCurrentWatermark()) {
		// if the watermark is already past the window fire immediately
		return TriggerResult.FIRE;
	} else {
		ctx.registerEventTimeTimer(window.maxTimestamp());
		return TriggerResult.CONTINUE;
	}
}
 
Example 11
Source File: EventTimeTrigger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the watermark is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the watermark is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentWatermark()) {
		ctx.registerEventTimeTimer(windowMaxTimestamp);
	}
}
 
Example 12
Source File: ProcessingTimeTrigger.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void onMerge(TimeWindow window,
		OnMergeContext ctx) {
	// only register a timer if the time is not yet past the end of the merged window
	// this is in line with the logic in onElement(). If the time is past the end of
	// the window onElement() will fire and setting a timer here would fire the window twice.
	long windowMaxTimestamp = window.maxTimestamp();
	if (windowMaxTimestamp > ctx.getCurrentProcessingTime()) {
		ctx.registerProcessingTimeTimer(windowMaxTimestamp);
	}
}
 
Example 13
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() ?
		TriggerResult.FIRE :
		TriggerResult.CONTINUE;
}
 
Example 14
Source File: WindowOperatorTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() || time == window.maxTimestamp() + cleanupTime ?
		TriggerResult.FIRE_AND_PURGE :
		TriggerResult.CONTINUE;
}
 
Example 15
Source File: WindowOperatorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() || time == window.maxTimestamp() + cleanupTime ?
		TriggerResult.FIRE_AND_PURGE :
		TriggerResult.CONTINUE;
}
 
Example 16
Source File: EventTimeTrigger.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() ?
		TriggerResult.FIRE :
		TriggerResult.CONTINUE;
}
 
Example 17
Source File: EventTimeTrigger.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() ?
		TriggerResult.FIRE :
		TriggerResult.CONTINUE;
}
 
Example 18
Source File: WindowOperatorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TriggerResult onEventTime(long time, TimeWindow window, TriggerContext ctx) {
	return time == window.maxTimestamp() || time == window.maxTimestamp() + cleanupTime ?
		TriggerResult.FIRE_AND_PURGE :
		TriggerResult.CONTINUE;
}