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
Analogue 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)
IStatefulComponent
This 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)
IStatefulBolt
Analogue to bolt function.
IBolt.execute(Tuple)
public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponent
Declare the output schema for all the streams of this topology.
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 © 2019 The Apache Software Foundation. All rights reserved.