繁体   English   中英

Apache Storm Bolt无法从其他Bolt发射接收任何元组

[英]Apache Storm Bolt cannot receive any Tuple from other Bolt emit

我是Storm的新手。 我想使用一个名为“ tileClean”的螺栓发出单个Stream ,而其他五个螺栓同时接收Stream 像这样: 流图像

如您所见,“一,二,三,四,五”螺栓将同时接收相同的数据。 但实际上,“一个,两个,三个,四个,五个”螺栓无法接收任何数据。 有我的代码:

@Override
public void execute(TupleWindow inputWindow) {
    logger.debug("clean");
    List<Tuple> tuples = inputWindow.get();
    //logger.debug("clean phrase. tuple size is : {}", tuples.size());
    for (Tuple input : tuples) {
        // some other code..

        //this._collector.emit(input, new Values(nal));
        this._collector.emit("stream_id_one", input, new Values(nal));
        this._collector.emit("stream_id_two", input, new Values(nal));
        this._collector.emit("stream_id_three", input, new Values(nal));
        this._collector.emit("stream_id_four", input, new Values(nal));
        this._collector.emit("stream_id_five", input, new Values(nal));

        this._collector.ack(input);
    }
}

@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    declarer.declare(new Fields(BoltConstant.EMIT_LOGOBJ));
    declarer.declareStream("stream_id_one", new Fields(BoltConstant.EMIT_LOGOBJ));
    declarer.declareStream("stream_id_two", new Fields(BoltConstant.EMIT_LOGOBJ));
    declarer.declareStream("stream_id_three", new Fields(BoltConstant.EMIT_LOGOBJ));
    declarer.declareStream("stream_id_four", new Fields(BoltConstant.EMIT_LOGOBJ));
    declarer.declareStream("stream_id_five", new Fields(BoltConstant.EMIT_LOGOBJ));
}

拓扑集为:

builder.setBolt("tileClean", cleanBolt, 1).shuffleGrouping("assembly");    
builder.setBolt("OneBolt", OneBolt, 1).shuffleGrouping("tileClean", "stream_id_one");
builder.setBolt("TwoBolt", TwoBolt, 1).shuffleGrouping("tileClean", "stream_id_two");
builder.setBolt("ThreeBolt", ThreeBolt, 1).shuffleGrouping("tileClean", "stream_id_three");
builder.setBolt("FourBolt", FourBolt, 1).shuffleGrouping("tileClean", "stream_id_four");
builder.setBolt("FiveBolt", FiveBolt, 1).shuffleGrouping("tileClean", "stream_id_five");

tileClean可以接收从assymble发出的元组,但其他螺栓不能接收。

我的代码有不正确的地方吗?

由于您已经省略了“ for循环”语句和第一个collector.emit语句之间的代码,因此消息无法通过的一种可能是在省略的代码之间进行适当的错误处理。 您可以通过在“ collector.emit”语句之前进行日志记录来检查代码是否确实到达那里,从而确保放置try-catch块或调试。

也可以在storm-ui上检查以上内容,其中将显示在喷嘴/螺栓之间传输消息的拓扑度量。 它还报告任务执行之间可能发生的任何错误消息。

另一种可能性是,如果您使用的是多节点集群,并且您的任务分散在该节点上(例如,如果您在拓扑配置中分配了1个以上的工作线程),请确保计算机可以与每台计算机进行通信其他通过网络在storm.yaml文件中配置的指定端口上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM