public class UpdateStateByKeyProcessor<K,V,R> extends Object implements StatefulProcessor<K,R>
Modifier and Type | Field and Description |
---|---|
protected ProcessorContext |
context |
Constructor and Description |
---|
UpdateStateByKeyProcessor(StateUpdater<V,R> stateUpdater) |
Modifier and Type | Method and Description |
---|---|
protected void |
execute(Pair<K,V> input)
Execute some operation on the input value.
|
void |
execute(T input,
String streamId)
Executes some operations on the input and possibly emits some results.
|
protected void |
finish()
This is triggered to signal the end of the current batch of values.
|
void |
init(ProcessorContext context)
Initializes the processor.
|
void |
initState(KeyValueState<K,R> keyValueState)
Initialize the state of the processor with the given
KeyValueState . |
protected <R> void |
mayBeForwardAggUpdate(Supplier<R> result)
Forwards the result update to downstream processors.
|
void |
punctuate(String stream)
Punctuation marks end of a batch which can be used to compute and pass the results of one stage in the pipeline to the next.
|
protected ProcessorContext context
public UpdateStateByKeyProcessor(StateUpdater<V,R> stateUpdater)
public void initState(KeyValueState<K,R> keyValueState)
StatefulProcessor
Initialize the state of the processor with the given KeyValueState
.
initState
in interface StatefulProcessor<K,R>
keyValueState
- the key-value stateprotected void execute(Pair<K,V> input)
input
- the inputpublic void init(ProcessorContext context)
Initializes the processor. This is typically invoked from the underlying storm bolt’s prepare method.
public void execute(T input, String streamId)
Executes some operations on the input and possibly emits some results.
Processors that do not care about the source stream should overrideBaseProcessor.execute(Object)
instead.public void punctuate(String stream)
Punctuation marks end of a batch which can be used to compute and pass the results of one stage in the pipeline to the next. For e.g. emit the results of an aggregation.
protected void finish()
protected final <R> void mayBeForwardAggUpdate(Supplier<R> result)
R
- the result typeresult
- the result functionCopyright © 2022 The Apache Software Foundation. All rights reserved.