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)
IStatefulBoltAnalogue to bolt function.
prepare 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)
IStatefulComponentThis method is invoked by the framework with the previously saved state of the component. This is invoked after prepare but before the component starts processing tuples.
state - the previously saved state of the component.public void execute(Tuple tuple)
IStatefulBoltAnalogue to bolt function.
IBolt.execute(Tuple)public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponentDeclare the output schema for all the streams of this topology.
declareOutputFields 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 © 2021 The Apache Software Foundation. All rights reserved.