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 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.-
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:IStatefulBolt
Analogue to bolt function.- Specified by:
prepare
in interfaceIStatefulBolt<KeyValueState<String,Long>>
- Overrides:
prepare
in classBaseStatefulBolt<KeyValueState<String,Long>>
- See Also:
IBolt.prepare(Map, TopologyContext, OutputCollector)
-
initState
public void initState(KeyValueState<String,Long> state)
Description copied from interface: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.- Parameters:
state
- the previously saved state of the component.
-
execute
public void execute(Tuple tuple)
Description copied from interface:IStatefulBolt
Analogue to bolt function.- See Also:
IBolt.execute(Tuple)
-
declareOutputFields
public void declareOutputFields(OutputFieldsDeclarer declarer)
Description copied from interface:IComponent
Declare the output schema for all the streams of this topology.- Specified by:
declareOutputFields
in interfaceIComponent
- Overrides:
declareOutputFields
in 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
-
-