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)
Tuple count based sliding window configuration.
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)
Tuple count and time duration based sliding window configuration.
windowLength
- the number of tuples in the windowslidingInterval
- the time duration after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.
windowLength
- the time duration of the windowslidingInterval
- the number of tuples after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval)
Time duration based sliding window configuration.
windowLength
- the time duration of the windowslidingInterval
- the time duration after which the window slidespublic BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.
windowLength
- the number of tuples in the windowpublic BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength)
A time duration based window that slides with every incoming tuple.
windowLength
- the time duration of the windowpublic BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.
count
- the number of tuples after which the window tumblespublic BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.
duration
- the time duration after which the window tumblespublic BaseWindowedBolt withTimestampField(String fieldName)
Specify a field in the tuple that represents the timestamp as a long value. If this field is not present in the incoming tuple, an IllegalArgumentException
will be thrown. The field MUST contain a timestamp in milliseconds
fieldName
- the name of the field that contains the timestamppublic BaseWindowedBolt withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.
timestampExtractor
- the TimestampExtractor
implementationpublic TimestampExtractor getTimestampExtractor()
IWindowedBolt
Return a 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)
Specify a stream id on which late tuples are going to be emitted. They are going to be accessible via the 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)
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.
duration
- the max lag durationpublic BaseWindowedBolt withWatermarkInterval(BaseWindowedBolt.Duration interval)
Specify the watermark event generation interval. For tuple based timestamps, watermark events are used to track the progress of time
interval
- the interval at which watermark events are generatedpublic void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
IWindowedBolt
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.
prepare
in interface IWindowedBolt
public void cleanup()
cleanup
in interface IWindowedBolt
public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponent
Declare the output schema for all the streams of this topology.
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
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 using TopologyBuilder
getComponentConfiguration
in interface IComponent
Copyright © 2019 The Apache Software Foundation. All rights reserved.