public class WordCounter extends BaseBasicBolt
This bolt is used by the HBase example. It simply emits the first field found in the incoming tuple as “word”, with a “count” of 1
.
1
will just increment the HBase counter by one.Constructor and Description |
---|
WordCounter() |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
void |
declareOutputFields(OutputFieldsDeclarer declarer)
Declare the output schema for all the streams of this topology.
|
void |
execute(Tuple input,
BasicOutputCollector collector)
Process the input tuple and optionally emit new tuples based on the input tuple.
|
Map<String,Object> |
getComponentConfiguration()
Declare configuration specific to this component.
|
void |
prepare(Map<String,Object> topoConf,
TopologyContext context) |
public void prepare(Map<String,Object> topoConf, TopologyContext context)
prepare
in interface IBasicBolt
prepare
in class BaseBasicBolt
public void execute(Tuple input, BasicOutputCollector collector)
IBasicBolt
Process the input tuple and optionally emit new tuples based on the input tuple.
All acking is managed for you. Throw a FailedException if you want to fail the tuple.
public void cleanup()
cleanup
in interface IBasicBolt
cleanup
in class BaseBasicBolt
public void declareOutputFields(OutputFieldsDeclarer declarer)
IComponent
Declare the output schema for all the streams of this topology.
declarer
- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct streampublic Map<String,Object> getComponentConfiguration()
IComponent
Declare configuration specific to this component. Only a subset of the “topology.*” configs can be overridden. The component configuration can be further overridden when constructing the topology using TopologyBuilder
getComponentConfiguration
in interface IComponent
getComponentConfiguration
in class BaseComponent
Copyright © 2022 The Apache Software Foundation. All rights reserved.