Class CloseWindowStrategy
java.lang.Object
com.northconcepts.datapipeline.group.CloseWindowStrategy
Determines when
GroupByReader closes an open sliding window.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CloseWindowStrategyand(CloseWindowStrategy... strategies) Closes windows if all of the supplied strategies request it.static CloseWindowStrategyhourlyScheduleInMinutes(int... minutesPastHour) Closes windows at fixed minutes past each hour (for example: 0, 15, 30, and 45 minutes past each hour).static CloseWindowStrategyhourlyScheduleInMinutes(String fieldName, int... minutesPastHour) Closes windows at fixed minutes past each hour for the specified datetime field (for example: 0, 15, 30, and 45 minutes past each hour).booleanReturnstrueif the window should be closed before adding the record orfalseif (the default).booleanstatic CloseWindowStrategylimitedRecords(long count) Closes the window after the specified amount of records has been collected.static CloseWindowStrategylimitedTime(long milliseconds) Closes windows after they've been open for the specified time.static CloseWindowStrategylimitedTime(String fieldName, long milliseconds) Closes windows after the specified datetime field has increased by a set amount of time since it was first seen.static CloseWindowStrategynever()Never closes open windows.static CloseWindowStrategyor(CloseWindowStrategy... strategies) Closes windows if any of the supplied strategies request it.static CloseWindowStrategyCloses windows on a set clock schedule.static CloseWindowStrategyCloses windows on a set clock schedule for the specified datetime field.abstract booleanshouldClose(Window window, GroupByReader groupByReader, Record record) Returns true if the given open window should be closed now;recordis the record being read or null when polling.
-
Field Details
-
CLOSE_WINDOW_MARGIN_MILLIS
public static final long CLOSE_WINDOW_MARGIN_MILLIS- See Also:
-
-
Constructor Details
-
CloseWindowStrategy
public CloseWindowStrategy()
-
-
Method Details
-
shouldClose
Returns true if the given open window should be closed now;recordis the record being read or null when polling. Open windows are checked oldest first until one stays open. -
isPollingRequired
public boolean isPollingRequired() -
isCloseBeforeAddingRecord
public boolean isCloseBeforeAddingRecord()Returnstrueif the window should be closed before adding the record orfalseif (the default). -
never
Never closes open windows. -
limitedTime
Closes windows after they've been open for the specified time. -
limitedTime
Closes windows after the specified datetime field has increased by a set amount of time since it was first seen. This is useful for aggregating hourly logs by their timestamp field.- Parameters:
fieldName- the datetime field to testmilliseconds- the amount of time the field should increase before closing the window
-
limitedRecords
Closes the window after the specified amount of records has been collected. -
scheduled
Closes windows on a set clock schedule. For example, every 30 minutes on the hour and half hour.- See Also:
-
scheduled
Closes windows on a set clock schedule for the specified datetime field. For example, every 30 minutes at 15 and 45 past the hour. This is useful for aggregating hourly logs at set times by their timestamp field.- Parameters:
fieldName- the datetime field to testscheduler- the scheduler to use- See Also:
-
hourlyScheduleInMinutes
Closes windows at fixed minutes past each hour (for example: 0, 15, 30, and 45 minutes past each hour). -
hourlyScheduleInMinutes
Closes windows at fixed minutes past each hour for the specified datetime field (for example: 0, 15, 30, and 45 minutes past each hour).- Parameters:
fieldName- the datetime field to testminutesPastHour-- Returns:
-
or
Closes windows if any of the supplied strategies request it. -
and
Closes windows if all of the supplied strategies request it.
-