public abstract class BaseWindowedBolt extends Object implements IWindowedBolt
Modifier and Type | Class and Description |
---|---|
static class |
BaseWindowedBolt.Count
Holds a count value for count based windows and sliding intervals.
|
static class |
BaseWindowedBolt.Duration
Holds a Time duration for time based windows and sliding intervals.
|
Modifier and Type | Field and Description |
---|---|
protected TimestampExtractor |
timestampExtractor |
protected Map<String,Object> |
windowConfiguration |
Modifier | Constructor and Description |
---|---|
protected |
BaseWindowedBolt() |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
void |
declareOutputFields(OutputFieldsDeclarer declarer)
Declare the output schema for all the streams of this topology.
|
Map<String,Object> |
getComponentConfiguration()
Declare configuration specific to this component.
|
TimestampExtractor |
getTimestampExtractor()
Return a
TimestampExtractor 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 the
IBolt.prepare(Map, TopologyContext, OutputCollector) except that while emitting,
the tuples are automatically anchored to the tuples in the inputWindow. |
BaseWindowedBolt |
withLag(BaseWindowedBolt.Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds.
|
BaseWindowedBolt |
withLateTupleStream(String streamId)
Specify a stream id on which late tuples are going to be emitted.
|
BaseWindowedBolt |
withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.
|
BaseWindowedBolt |
withTimestampField(String fieldName)
Specify a field in the tuple that represents the timestamp as a long value.
|
BaseWindowedBolt |
withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.
|
BaseWindowedBolt |
withTumblingWindow(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.
|
BaseWindowedBolt |
withWatermarkInterval(BaseWindowedBolt.Duration interval)
Specify the watermark event generation interval.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Count windowLength,
BaseWindowedBolt.Count slidingInterval)
Tuple count based sliding window configuration.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Count windowLength,
BaseWindowedBolt.Duration slidingInterval)
Tuple count and time duration based sliding window configuration.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Duration windowLength)
A time duration based window that slides with every incoming tuple.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Duration windowLength,
BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.
|
BaseWindowedBolt |
withWindow(BaseWindowedBolt.Duration windowLength,
BaseWindowedBolt.Duration slidingInterval)
Time duration based sliding window configuration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
protected TimestampExtractor timestampExtractor
public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval)
windowLength
- the number of tuples in the windowslidingInterval
- the number of tuples after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Duration slidingInterval)
windowLength
- the number of tuples in the windowslidingInterval
- the time duration after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval)
windowLength
- the time duration of the windowslidingInterval
- the number of tuples after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval)
windowLength
- the time duration of the windowslidingInterval
- the time duration after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength)
windowLength
- the number of tuples in the windowpublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength)
windowLength
- the time duration of the windowpublic BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Count count)
count
- the number of tuples after which the window tumblespublic BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Duration duration)
duration
- the time duration after which the window tumblespublic BaseWindowedBolt withTimestampField(String fieldName)
IllegalArgumentException
will be thrown. The field MUST contain a timestamp in millisecondsfieldName
- the name of the field that contains the timestamppublic BaseWindowedBolt withTimestampExtractor(TimestampExtractor timestampExtractor)
timestampExtractor
- the TimestampExtractor
implementationpublic TimestampExtractor getTimestampExtractor()
IWindowedBolt
TimestampExtractor
for extracting timestamps from a tuple for event time based processing, or null for processing
time.getTimestampExtractor
in interface IWindowedBolt
public BaseWindowedBolt withLateTupleStream(String streamId)
WindowedBoltExecutor.LATE_TUPLE_FIELD
field. It must be defined on a per-component basis, and in
conjunction with the withTimestampField(java.lang.String)
, otherwise IllegalArgumentException
will be thrown.streamId
- the name of the stream used to emit late tuples onpublic BaseWindowedBolt withLag(BaseWindowedBolt.Duration duration)
duration
- the max lag durationpublic BaseWindowedBolt withWatermarkInterval(BaseWindowedBolt.Duration interval)
interval
- the interval at which watermark events are generatedpublic void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
IWindowedBolt
IBolt.prepare(Map, TopologyContext, OutputCollector)
except that while emitting,
the tuples are automatically anchored to the tuples in the inputWindow.prepare
in interface IWindowedBolt
public void cleanup()
cleanup
in interface IWindowedBolt
public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponent
declareOutputFields
in interface IComponent
declarer
- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct streampublic Map<String,Object> getComponentConfiguration()
IComponent
TopologyBuilder
getComponentConfiguration
in interface IComponent
Copyright © 2023 The Apache Software Foundation. All rights reserved.