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, preRollback
public void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
IStatefulBolt
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)
IStatefulComponent
state
- the previously saved state of the component.public void execute(Tuple tuple)
IStatefulBolt
IBolt.execute(Tuple)
public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponent
declareOutputFields
in interface IComponent
declareOutputFields
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.