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>>
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
declareOutputFields
(OutputFieldsDeclarer declarer) Declare the output schema for all the streams of this topology.void
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
-
Constructor Details
-
StatefulWordCounter
public StatefulWordCounter()
-
-
Method Details
-
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:
-
initState
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
Description copied from interface:IStatefulBolt
Analogue to bolt function.- See Also:
-
declareOutputFields
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
-