public class StatefulWordCounter extends BaseStatefulBolt<KeyValueState<String,Long>>
| Constructor and Description |
|---|
StatefulWordCounter() |
| Modifier and Type | Method and Description |
|---|---|
void |
declareOutputFields(OutputFieldsDeclarer declarer)
Declare the output schema for all the streams of this topology.
|
void |
execute(Tuple tuple)
Analogue to bolt function.
|
void |
initState(KeyValueState<String,Long> state)
This method is invoked by the framework with the previously saved state of the component.
|
void |
prepare(Map<String,Object> topoConf,
TopologyContext context,
OutputCollector collector)
Analogue to bolt function.
|
cleanup, getComponentConfiguration, preCommit, prePrepare, preRollbackpublic void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
IStatefulBoltprepare in interface IStatefulBolt<KeyValueState<String,Long>>prepare in class BaseStatefulBolt<KeyValueState<String,Long>>IBolt.prepare(Map, TopologyContext, OutputCollector)public void initState(KeyValueState<String,Long> state)
IStatefulComponentstate - the previously saved state of the component.public void execute(Tuple tuple)
IStatefulBoltIBolt.execute(Tuple)public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponentdeclareOutputFields in interface IComponentdeclareOutputFields in class BaseStatefulBolt<KeyValueState<String,Long>>declarer - this is used to declare output stream ids, output fields, and whether or not each output stream is a direct streamCopyright © 2023 The Apache Software Foundation. All rights reserved.