Package org.apache.storm.topology.base
Class BaseWindowedBolt
java.lang.Object
org.apache.storm.topology.base.BaseWindowedBolt
- All Implemented Interfaces:
Serializable
,IComponent
,IWindowedBolt
- Direct Known Subclasses:
BaseStatefulWindowedBolt
,JoinBolt
,SlidingWindowSumBolt
,TestWindowBolt
,TimeDataVerificationBolt
,VerificationBolt
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds a count value for count based windows and sliding intervals.static class
Holds a Time duration for time based windows and sliding intervals. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
void
declareOutputFields
(OutputFieldsDeclarer declarer) Declare the output schema for all the streams of this topology.Declare configuration specific to this component.Return aTimestampExtractor
for extracting timestamps from a tuple for event time based processing, or null for processing time.void
prepare
(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) This is similar to theIBolt.prepare(Map, TopologyContext, OutputCollector)
except that while emitting, the tuples are automatically anchored to the tuples in the inputWindow.withLag
(BaseWindowedBolt.Duration duration) Specify the maximum time lag of the tuple timestamp in milliseconds.withLateTupleStream
(String streamId) Specify a stream id on which late tuples are going to be emitted.withTimestampExtractor
(TimestampExtractor timestampExtractor) Specify the timestamp extractor implementation.withTimestampField
(String fieldName) Specify a field in the tuple that represents the timestamp as a long value.A count based tumbling window.withTumblingWindow
(BaseWindowedBolt.Duration duration) A time duration based tumbling window.Specify the watermark event generation interval.withWindow
(BaseWindowedBolt.Count windowLength) A tuple count based window that slides with every incoming tuple.withWindow
(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval) Tuple count based sliding window configuration.withWindow
(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Duration slidingInterval) Tuple count and time duration based sliding window configuration.withWindow
(BaseWindowedBolt.Duration windowLength) A time duration based window that slides with every incoming tuple.withWindow
(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval) Time duration and count based sliding window configuration.withWindow
(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval) Time duration based sliding window configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.storm.topology.IWindowedBolt
execute
-
Field Details
-
windowConfiguration
-
timestampExtractor
-
-
Constructor Details
-
BaseWindowedBolt
protected BaseWindowedBolt()
-
-
Method Details
-
withWindow
public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval) Tuple count based sliding window configuration.- Parameters:
windowLength
- the number of tuples in the windowslidingInterval
- the number of tuples after which the window slides
-
withWindow
public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Duration slidingInterval) Tuple count and time duration based sliding window configuration.- Parameters:
windowLength
- the number of tuples in the windowslidingInterval
- the time duration after which the window slides
-
withWindow
public BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval) Time duration and count based sliding window configuration.- Parameters:
windowLength
- the time duration of the windowslidingInterval
- the number of tuples after which the window slides
-
withWindow
public BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval) Time duration based sliding window configuration.- Parameters:
windowLength
- the time duration of the windowslidingInterval
- the time duration after which the window slides
-
withWindow
A tuple count based window that slides with every incoming tuple.- Parameters:
windowLength
- the number of tuples in the window
-
withWindow
A time duration based window that slides with every incoming tuple.- Parameters:
windowLength
- the time duration of the window
-
withTumblingWindow
A count based tumbling window.- Parameters:
count
- the number of tuples after which the window tumbles
-
withTumblingWindow
A time duration based tumbling window.- Parameters:
duration
- the time duration after which the window tumbles
-
withTimestampField
Specify a field in the tuple that represents the timestamp as a long value. If this field is not present in the incoming tuple, anIllegalArgumentException
will be thrown. The field MUST contain a timestamp in milliseconds- Parameters:
fieldName
- the name of the field that contains the timestamp
-
withTimestampExtractor
Specify the timestamp extractor implementation.- Parameters:
timestampExtractor
- theTimestampExtractor
implementation
-
getTimestampExtractor
Description copied from interface:IWindowedBolt
Return aTimestampExtractor
for extracting timestamps from a tuple for event time based processing, or null for processing time.- Specified by:
getTimestampExtractor
in interfaceIWindowedBolt
- Returns:
- the timestamp extractor
-
withLateTupleStream
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 thewithTimestampField(java.lang.String)
, otherwiseIllegalArgumentException
will be thrown.- Parameters:
streamId
- the name of the stream used to emit late tuples on
-
withLag
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.- Parameters:
duration
- the max lag duration
-
withWatermarkInterval
Specify the watermark event generation interval. For tuple based timestamps, watermark events are used to track the progress of time- Parameters:
interval
- the interval at which watermark events are generated
-
prepare
public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) Description copied from interface:IWindowedBolt
This is similar to theIBolt.prepare(Map, TopologyContext, OutputCollector)
except that while emitting, the tuples are automatically anchored to the tuples in the inputWindow.- Specified by:
prepare
in interfaceIWindowedBolt
-
cleanup
public void cleanup()- Specified by:
cleanup
in interfaceIWindowedBolt
-
declareOutputFields
Description copied from interface:IComponent
Declare the output schema for all the streams of this topology.- Specified by:
declareOutputFields
in interfaceIComponent
- Parameters:
declarer
- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
-
getComponentConfiguration
Description copied from interface:IComponent
Declare configuration specific to this component. Only a subset of the "topology.*" configs can be overridden. The component configuration can be further overridden when constructing the topology usingTopologyBuilder
- Specified by:
getComponentConfiguration
in interfaceIComponent
-