如果注解builder.setBolt,那么它运行正确。请告诉我哪里出错了
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("words", new TestWordSpout(), 3);
//Calling setBolt
builder.setBolt("exc", new ExclaimBolt(),3)
.allGrouping("words");
Config conf = new Config();
conf.setDebug(false);
//conf.setNumWorkers(2);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
1条答案
按热度按时间wqnecbli1#
没有在Spout中声明输出字段。声明后工作正常。
代码示例(在u bolt类中):