我有以下风暴拓扑代码,我在集群上运行:
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word-reader", new WordReader());
builder.setBolt("word-normalizer", new WordNormalizer())
.shuffleGrouping("word-reader");
builder.setBolt("word-counter", new WordCounter()).fieldsGrouping(
"word-normalizer", new Fields("word"));
Config conf = new Config();
conf.put("wordsFile", args[0]);
conf.setDebug(false);
conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);
try {
StormSubmitter.submitTopology("Test-topology", conf,
builder.createTopology());
} catch (AlreadyAliveException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidTopologyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
当我调试它时,以下cleanup()
方法不在类中运行WordCounter
......
@Override
public void cleanup() {
System.out.println("-- Word Counter --");
}
...并且拓扑没有完成运行。