Package org.apache.storm.flux.examples
Class StatefulWordCounter
- java.lang.Object
-
- org.apache.storm.topology.base.BaseStatefulBolt<KeyValueState<String,Long>>
-
- org.apache.storm.flux.examples.StatefulWordCounter
-
- All Implemented Interfaces:
Serializable,IComponent,IStatefulBolt<KeyValueState<String,Long>>,IStatefulComponent<KeyValueState<String,Long>>
public class StatefulWordCounter extends BaseStatefulBolt<KeyValueState<String,Long>>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StatefulWordCounter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeclareOutputFields(OutputFieldsDeclarer declarer)Declare the output schema for all the streams of this topology.voidexecute(Tuple tuple)Analogue to bolt function.voidinitState(KeyValueState<String,Long> state)This method is invoked by the framework with the previously saved state of the component.voidprepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)Analogue to bolt function.-
Methods inherited from class org.apache.storm.topology.base.BaseStatefulBolt
cleanup, getComponentConfiguration, preCommit, prePrepare, preRollback
-
-
-
-
Method Detail
-
prepare
public void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
Description copied from interface:IStatefulBoltAnalogue to bolt function.- Specified by:
preparein interfaceIStatefulBolt<KeyValueState<String,Long>>- Overrides:
preparein classBaseStatefulBolt<KeyValueState<String,Long>>- See Also:
IBolt.prepare(Map, TopologyContext, OutputCollector)
-
initState
public void initState(KeyValueState<String,Long> state)
Description copied from interface: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.- Parameters:
state- the previously saved state of the component.
-
execute
public void execute(Tuple tuple)
Description copied from interface:IStatefulBoltAnalogue to bolt function.- See Also:
IBolt.execute(Tuple)
-
declareOutputFields
public void declareOutputFields(OutputFieldsDeclarer declarer)
Description copied from interface:IComponentDeclare the output schema for all the streams of this topology.- Specified by:
declareOutputFieldsin interfaceIComponent- Overrides:
declareOutputFieldsin classBaseStatefulBolt<KeyValueState<String,Long>>- Parameters:
declarer- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
-
-