Package org.apache.heron.api.bolt
Class BaseStatefulWindowedBolt<K extends Serializable,V extends Serializable>
- java.lang.Object
-
- org.apache.heron.api.bolt.BaseWindowedBolt
-
- org.apache.heron.api.bolt.BaseStatefulWindowedBolt<K,V>
-
- All Implemented Interfaces:
Serializable
,IStatefulWindowedBolt<K,V>
,IWindowedBolt
,IComponent
,IStatefulComponent<K,V>
public abstract class BaseStatefulWindowedBolt<K extends Serializable,V extends Serializable> extends BaseWindowedBolt implements IStatefulWindowedBolt<K,V>
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.heron.api.bolt.BaseWindowedBolt
BaseWindowedBolt.Count
-
-
Field Summary
-
Fields inherited from class org.apache.heron.api.bolt.BaseWindowedBolt
timestampExtractor, windowConfiguration
-
-
Constructor Summary
Constructors Constructor Description BaseStatefulWindowedBolt()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
preSave(String checkpointId)
This is a hook for the component to perform some actions just before the framework saves its state.BaseStatefulWindowedBolt<K,V>
withLag(Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds.BaseStatefulWindowedBolt<K,V>
withLateTupleStream(String streamName)
Specify a stream id on which late tuples are going to be emitted.BaseStatefulWindowedBolt<K,V>
withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.BaseStatefulWindowedBolt<K,V>
withTimestampField(String fieldName)
Specify a field in the tuple that represents the timestamp as a long value.BaseStatefulWindowedBolt<K,V>
withTumblingWindow(Duration duration)
A time duration based tumbling window.BaseStatefulWindowedBolt<K,V>
withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.BaseStatefulWindowedBolt<K,V>
withWatermarkInterval(Duration interval)
Specify the watermark event generation interval.BaseStatefulWindowedBolt<K,V>
withWindow(Duration windowLength)
A time duration based window that slides with every incoming tuple.BaseStatefulWindowedBolt<K,V>
withWindow(Duration windowLength, Duration slidingInterval)
Time duration based sliding window configuration.BaseStatefulWindowedBolt<K,V>
withWindow(Duration windowLength, BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.BaseStatefulWindowedBolt<K,V>
withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.BaseStatefulWindowedBolt<K,V>
withWindow(BaseWindowedBolt.Count windowLength, Duration slidingInterval)
Tuple count and time duration based sliding window configuration.BaseStatefulWindowedBolt<K,V>
withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval)
Tuple count based sliding window configuration.-
Methods inherited from class org.apache.heron.api.bolt.BaseWindowedBolt
cleanup, declareOutputFields, getComponentConfiguration, getTimestampExtractor, prepare, withCustomEvictor, withCustomTrigger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.heron.api.topology.IComponent
declareOutputFields, getComponentConfiguration
-
Methods inherited from interface org.apache.heron.api.topology.IStatefulComponent
initState
-
Methods inherited from interface org.apache.heron.api.bolt.IWindowedBolt
cleanup, execute, getTimestampExtractor, prepare
-
-
-
-
Method Detail
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval)
Tuple count based sliding window configuration.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the number of tuples in the windowslidingInterval
- the number of tuples after which the window slides
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(BaseWindowedBolt.Count windowLength, Duration slidingInterval)
Tuple count and time duration based sliding window configuration.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the number of tuples in the windowslidingInterval
- the time duration after which the window slides
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(Duration windowLength, BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the time duration of the windowslidingInterval
- the number of tuples after which the window slides
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(Duration windowLength, Duration slidingInterval)
Time duration based sliding window configuration.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the time duration of the windowslidingInterval
- the time duration after which the window slides
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the number of tuples in the window
-
withWindow
public BaseStatefulWindowedBolt<K,V> withWindow(Duration windowLength)
A time duration based window that slides with every incoming tuple.- Overrides:
withWindow
in classBaseWindowedBolt
- Parameters:
windowLength
- the time duration of the window
-
withTumblingWindow
public BaseStatefulWindowedBolt<K,V> withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.- Overrides:
withTumblingWindow
in classBaseWindowedBolt
- Parameters:
count
- the number of tuples after which the window tumbles
-
withTumblingWindow
public BaseStatefulWindowedBolt<K,V> withTumblingWindow(Duration duration)
A time duration based tumbling window.- Overrides:
withTumblingWindow
in classBaseWindowedBolt
- Parameters:
duration
- the time duration after which the window tumbles
-
withTimestampField
public BaseStatefulWindowedBolt<K,V> withTimestampField(String fieldName)
Specify a field in the tuple that represents the timestamp as a long value. The timestamp should also be in milliseconds. If this field is not present in the incoming tuple, anIllegalArgumentException
will be thrown.- Overrides:
withTimestampField
in classBaseWindowedBolt
- Parameters:
fieldName
- the name of the field that contains the timestamp
-
withTimestampExtractor
public BaseStatefulWindowedBolt<K,V> withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.- Overrides:
withTimestampExtractor
in classBaseWindowedBolt
- Parameters:
timestampExtractor
- theTimestampExtractor
implementation
-
withLateTupleStream
public BaseStatefulWindowedBolt<K,V> withLateTupleStream(String streamName)
Specify a stream id on which late tuples are going to be emitted. They are going to be accessible via theWindowedBoltExecutor.LATE_TUPLE_FIELD
field. It must be defined on a per-component basis, and in conjunction with theBaseWindowedBolt.withTimestampField(java.lang.String)
, otherwiseIllegalArgumentException
will be thrown.- Overrides:
withLateTupleStream
in classBaseWindowedBolt
- Parameters:
streamName
- the name of the stream used to emit late tuples on
-
withLag
public BaseStatefulWindowedBolt<K,V> withLag(Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds. It means that the tuple timestamps cannot be out of order by more than this amount.- Overrides:
withLag
in classBaseWindowedBolt
- Parameters:
duration
- the max lag duration
-
withWatermarkInterval
public BaseStatefulWindowedBolt<K,V> withWatermarkInterval(Duration interval)
Specify the watermark event generation interval. For tuple based timestamps, watermark events are used to track the progress of time- Overrides:
withWatermarkInterval
in classBaseWindowedBolt
- Parameters:
interval
- the interval at which watermark events are generated
-
preSave
public void preSave(String checkpointId)
Description copied from interface:IStatefulComponent
This is a hook for the component to perform some actions just before the framework saves its state.- Specified by:
preSave
in interfaceIStatefulComponent<K extends Serializable,V extends Serializable>
- Parameters:
checkpointId
- the ID of the checkpoint
-
-