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(java.lang.String streamName)
Specify a stream id on which late tuples are going to be emitted.
|
BaseStatefulWindowedBolt<T> |
withMaxEventsInMemory(long maxEventsInMem)
The maximum number of window events to keep in memory.
|
BaseStatefulWindowedBolt<T> |
withMessageIdField(java.lang.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(java.lang.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)
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)
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)
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)
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)
withWindow
in class BaseWindowedBolt
windowLength
- the number of tuples in the windowpublic BaseStatefulWindowedBolt<T> withWindow(BaseWindowedBolt.Duration windowLength)
withWindow
in class BaseWindowedBolt
windowLength
- the time duration of the windowpublic BaseStatefulWindowedBolt<T> withTumblingWindow(BaseWindowedBolt.Count count)
withTumblingWindow
in class BaseWindowedBolt
count
- the number of tuples after which the window tumblespublic BaseStatefulWindowedBolt<T> withTumblingWindow(BaseWindowedBolt.Duration duration)
withTumblingWindow
in class BaseWindowedBolt
duration
- the time duration after which the window tumblespublic BaseStatefulWindowedBolt<T> withTimestampField(java.lang.String fieldName)
IllegalArgumentException
will be thrown. The field MUST contain a timestamp
in millisecondswithTimestampField
in class BaseWindowedBolt
fieldName
- the name of the field that contains the timestamppublic BaseStatefulWindowedBolt<T> withTimestampExtractor(TimestampExtractor timestampExtractor)
withTimestampExtractor
in class BaseWindowedBolt
timestampExtractor
- the TimestampExtractor
implementationpublic BaseStatefulWindowedBolt<T> withLateTupleStream(java.lang.String streamName)
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)
withLag
in class BaseWindowedBolt
duration
- the max lag durationpublic BaseStatefulWindowedBolt<T> withWatermarkInterval(BaseWindowedBolt.Duration interval)
withWatermarkInterval
in class BaseWindowedBolt
interval
- the interval at which watermark events are generatedpublic BaseStatefulWindowedBolt<T> withMessageIdField(java.lang.String fieldName)
fieldName
- the name of the field that contains the message idpublic BaseStatefulWindowedBolt<T> withPersistence()
withMaxEventsInMemory(long)
.public BaseStatefulWindowedBolt<T> withMaxEventsInMemory(long maxEventsInMem)
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
.maxEventsInMem
- the maximum number of window events to keep in memorypublic boolean isPersistent()
IStatefulWindowedBolt
The default is to keep all the window events in memory.
isPersistent
in interface IStatefulWindowedBolt<T extends State>
public long maxEventsInMemory()
IStatefulWindowedBolt
maxEventsInMemory
in interface IStatefulWindowedBolt<T extends State>
public void preCommit(long txid)
IStatefulComponent
preCommit
in interface IStatefulComponent<T extends State>
public void prePrepare(long txid)
IStatefulComponent
prePrepare
in interface IStatefulComponent<T extends State>
public void preRollback()
IStatefulComponent
preRollback
in interface IStatefulComponent<T extends State>