public abstract class BaseStatefulWindowedBolt<T extends State> extends BaseWindowedBolt implements IStatefulWindowedBolt<T>
BaseWindowedBolt.Count, BaseWindowedBolt.Duration
timestampExtractor, windowConfiguration
Constructor and Description |
---|
BaseStatefulWindowedBolt() |
Modifier and Type | Method and Description |
---|---|
boolean |
isPersistent()
If the stateful windowed bolt should have its windows persisted in state and maintain a subset of events in memory.
|
long |
maxEventsInMemory()
The maximum number of window events to keep in memory.
|
void |
preCommit(long txid)
This is a hook for the component to perform some actions just before the framework commits its state.
|
void |
prePrepare(long txid)
This is a hook for the component to perform some actions just before the framework prepares its state.
|
void |
preRollback()
This is a hook for the component to perform some actions just before the framework rolls back the prepared state.
|
BaseStatefulWindowedBolt<T> |
withLag(BaseWindowedBolt.Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds.
|
BaseStatefulWindowedBolt<T> |
withLateTupleStream(String streamName)
Specify a stream id on which late tuples are going to be emitted.
|
BaseStatefulWindowedBolt<T> |
withMaxEventsInMemory(long maxEventsInMemory)
The maximum number of window events to keep in memory.
|
BaseStatefulWindowedBolt<T> |
withMessageIdField(String fieldName)
Specify the name of the field in the tuple that holds the message id.
|
BaseStatefulWindowedBolt<T> |
withPersistence()
If set, the stateful windowed bolt would use the backend state for window persistence and only keep a sub-set of events in memory as specified by
withMaxEventsInMemory(long) . |
BaseStatefulWindowedBolt<T> |
withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.
|
BaseStatefulWindowedBolt<T> |
withTimestampField(String fieldName)
Specify a field in the tuple that represents the timestamp as a long value.
|
BaseStatefulWindowedBolt<T> |
withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.
|
BaseStatefulWindowedBolt<T> |
withTumblingWindow(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.
|
BaseStatefulWindowedBolt<T> |
withWatermarkInterval(BaseWindowedBolt.Duration interval)
Specify the watermark event generation interval.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Count windowLength,
BaseWindowedBolt.Count slidingInterval)
Tuple count based sliding window configuration.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Count windowLength,
BaseWindowedBolt.Duration slidingInterval)
Tuple count and time duration based sliding window configuration.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Duration windowLength)
A time duration based window that slides with every incoming tuple.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Duration windowLength,
BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.
|
BaseStatefulWindowedBolt<T> |
withWindow(BaseWindowedBolt.Duration windowLength,
BaseWindowedBolt.Duration slidingInterval)
Time duration based sliding window configuration.
|
cleanup, declareOutputFields, getComponentConfiguration, getTimestampExtractor, prepare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initState
cleanup, execute, getTimestampExtractor, prepare
declareOutputFields, getComponentConfiguration
public BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval)
Tuple count based sliding window configuration.
withWindow
in class BaseWindowedBolt
windowLength
- the number of tuples in the windowslidingInterval
- the number of tuples after which the window slidespublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Duration slidingInterval)
Tuple count and time duration based sliding window configuration.
withWindow
in class BaseWindowedBolt
windowLength
- the number of tuples in the windowslidingInterval
- the time duration after which the window slidespublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval)
Time duration and count based sliding window configuration.
withWindow
in class BaseWindowedBolt
windowLength
- the time duration of the windowslidingInterval
- the number of tuples after which the window slidespublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval)
Time duration based sliding window configuration.
withWindow
in class BaseWindowedBolt
windowLength
- the time duration of the windowslidingInterval
- the time duration after which the window slidespublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Count windowLength)
A tuple count based window that slides with every incoming tuple.
withWindow
in class BaseWindowedBolt
windowLength
- the number of tuples in the windowpublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Duration windowLength)
A time duration based window that slides with every incoming tuple.
withWindow
in class BaseWindowedBolt
windowLength
- the time duration of the windowpublic BaseStatefulWindowedBolt<T> withTumblingWindow(BaseWindowedBolt.Count count)
A count based tumbling window.
withTumblingWindow
in class BaseWindowedBolt
count
- the number of tuples after which the window tumblespublic BaseStatefulWindowedBolt<T> withTumblingWindow(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.
withTumblingWindow
in class BaseWindowedBolt
duration
- the time duration after which the window tumblespublic BaseStatefulWindowedBolt<T> 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
withTimestampField
in class BaseWindowedBolt
fieldName
- the name of the field that contains the timestamppublic BaseStatefulWindowedBolt<T> withTimestampExtractor(TimestampExtractor timestampExtractor)
Specify the timestamp extractor implementation.
withTimestampExtractor
in class BaseWindowedBolt
timestampExtractor
- the TimestampExtractor
implementationpublic BaseStatefulWindowedBolt<T> withLateTupleStream(String streamName)
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 BaseWindowedBolt.withTimestampField(java.lang.String)
, otherwise IllegalArgumentException
will be thrown.
withLateTupleStream
in class BaseWindowedBolt
streamName
- the name of the stream used to emit late tuples onpublic BaseStatefulWindowedBolt<T> 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.
withLag
in class BaseWindowedBolt
duration
- the max lag durationpublic BaseStatefulWindowedBolt<T> withWatermarkInterval(BaseWindowedBolt.Duration interval)
Specify the watermark event generation interval. For tuple based timestamps, watermark events are used to track the progress of time
withWatermarkInterval
in class BaseWindowedBolt
interval
- the interval at which watermark events are generatedpublic BaseStatefulWindowedBolt<T> withMessageIdField(String fieldName)
Specify the name of the field in the tuple that holds the message id. This is used to track the windowing boundaries and re-evaluating the windowing operation during recovery of IStatefulWindowedBolt
fieldName
- the name of the field that contains the message idpublic BaseStatefulWindowedBolt<T> withPersistence()
If set, the stateful windowed bolt would use the backend state for window persistence and only keep a sub-set of events in memory as specified by withMaxEventsInMemory(long)
.
public BaseStatefulWindowedBolt<T> withMaxEventsInMemory(long maxEventsInMemory)
The maximum number of window events to keep in memory. This is meaningful only if withPersistence()
is also set. As the number of events in memory grows close to the maximum, the events that are less likely to be used again are evicted and persisted. The default value for this is 1,000,000
.
maxEventsInMemory
- the maximum number of window events to keep in memorypublic boolean isPersistent()
IStatefulWindowedBolt
If the stateful windowed bolt should have its windows persisted in state and maintain a subset of events in memory.
The default is to keep all the window events in memory.
isPersistent
in interface IStatefulWindowedBolt<T extends State>
public long maxEventsInMemory()
IStatefulWindowedBolt
The maximum number of window events to keep in memory.
maxEventsInMemory
in interface IStatefulWindowedBolt<T extends State>
public void preCommit(long txid)
IStatefulComponent
This is a hook for the component to perform some actions just before the framework commits its state.
preCommit
in interface IStatefulComponent<T extends State>
public void prePrepare(long txid)
IStatefulComponent
This is a hook for the component to perform some actions just before the framework prepares its state.
prePrepare
in interface IStatefulComponent<T extends State>
public void preRollback()
IStatefulComponent
This is a hook for the component to perform some actions just before the framework rolls back the prepared state.
preRollback
in interface IStatefulComponent<T extends State>
Copyright © 2022 The Apache Software Foundation. All rights reserved.