storm每一个bolt在emit之后需要把数据传递到下一个bolt,所以declareOUtputFields 一定要写
默认的情况下不用加streamId,如果加了streamId,后面的bolt在使用shuffleGrouping时一定要写上steamId
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
// outputFieldsDeclarer.declare(new Fields("source"));
}
加streamId为
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
// outputFieldsDeclarer.declare("streamId",new Fields("source"));
}
topology写法如下
builder.setBolt("bolt", new SenqueceBolt()).shuffleGrouping("spout","streamId");