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 SummaryNested ClassesModifier and TypeClassDescriptionstatic classHolds a count value for count based windows and sliding intervals.static classHolds a Time duration for time based windows and sliding intervals.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanup()voiddeclareOutputFields(OutputFieldsDeclarer declarer) Declare the output schema for all the streams of this topology.Declare configuration specific to this component.Return aTimestampExtractorfor extracting timestamps from a tuple for event time based processing, or null for processing time.voidprepare(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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.storm.topology.IWindowedBoltexecute
- 
Field Details- 
windowConfiguration
- 
timestampExtractor
 
- 
- 
Constructor Details- 
BaseWindowedBoltprotected BaseWindowedBolt()
 
- 
- 
Method Details- 
withWindowpublic BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval) Tuple count based sliding window configuration.- Parameters:
- windowLength- the number of tuples in the window
- slidingInterval- the number of tuples after which the window slides
 
- 
withWindowpublic 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 window
- slidingInterval- the time duration after which the window slides
 
- 
withWindowpublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval) Time duration and count based sliding window configuration.- Parameters:
- windowLength- the time duration of the window
- slidingInterval- the number of tuples after which the window slides
 
- 
withWindowpublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval) Time duration based sliding window configuration.- Parameters:
- windowLength- the time duration of the window
- slidingInterval- the time duration after which the window slides
 
- 
withWindowA tuple count based window that slides with every incoming tuple.- Parameters:
- windowLength- the number of tuples in the window
 
- 
withWindowA time duration based window that slides with every incoming tuple.- Parameters:
- windowLength- the time duration of the window
 
- 
withTumblingWindowA count based tumbling window.- Parameters:
- count- the number of tuples after which the window tumbles
 
- 
withTumblingWindowA time duration based tumbling window.- Parameters:
- duration- the time duration after which the window tumbles
 
- 
withTimestampFieldSpecify a field in the tuple that represents the timestamp as a long value. If this field is not present in the incoming tuple, anIllegalArgumentExceptionwill be thrown. The field MUST contain a timestamp in milliseconds- Parameters:
- fieldName- the name of the field that contains the timestamp
 
- 
withTimestampExtractorSpecify the timestamp extractor implementation.- Parameters:
- timestampExtractor- the- TimestampExtractorimplementation
 
- 
getTimestampExtractorDescription copied from interface:IWindowedBoltReturn aTimestampExtractorfor extracting timestamps from a tuple for event time based processing, or null for processing time.- Specified by:
- getTimestampExtractorin interface- IWindowedBolt
- Returns:
- the timestamp extractor
 
- 
withLateTupleStreamSpecify a stream id on which late tuples are going to be emitted. They are going to be accessible via theWindowedBoltExecutor.LATE_TUPLE_FIELDfield. It must be defined on a per-component basis, and in conjunction with thewithTimestampField(java.lang.String), otherwiseIllegalArgumentExceptionwill be thrown.- Parameters:
- streamId- the name of the stream used to emit late tuples on
 
- 
withLagSpecify 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
 
- 
withWatermarkIntervalSpecify 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
 
- 
preparepublic void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) Description copied from interface:IWindowedBoltThis 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:
- preparein interface- IWindowedBolt
 
- 
cleanuppublic void cleanup()- Specified by:
- cleanupin interface- IWindowedBolt
 
- 
declareOutputFieldsDescription copied from interface:IComponentDeclare the output schema for all the streams of this topology.- Specified by:
- declareOutputFieldsin interface- IComponent
- Parameters:
- declarer- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
 
- 
getComponentConfigurationDescription copied from interface:IComponentDeclare 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:
- getComponentConfigurationin interface- IComponent
 
 
-