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) |
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) |
cleanup, getComponentConfiguration, preCommit, prePrepare, preRollback
public void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
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)
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.