简体   繁体   English

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

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

I'm newbie for Storm. 我是Storm的新手。 I want to use one bolt named 'tileClean' to emit single Stream , and other five bolts to receive the Stream at same time. 我想使用一个名为“ tileClean”的螺栓发出单个Stream ,而其他五个螺栓同时接收Stream like this: flow image 像这样: 流图像

as you see, "one,two,three,four,five" bolt will received same data at the same time. 如您所见,“一,二,三,四,五”螺栓将同时接收相同的数据。 but in actually, "one,two,three,four,five" bolts cannot receive any data. 但实际上,“一个,两个,三个,四个,五个”螺栓无法接收任何数据。 there are my codes: 有我的代码:

@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));
}

and topology set is: 拓扑集为:

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 can receive Tuples that emit from assymble , but other bolts cannot receive. tileClean可以接收从assymble发出的元组,但其他螺栓不能接收。

is there my code anything incorrect? 我的代码有不正确的地方吗?

As you have omitted the code between the "for loop" statement and the first collector.emit statement, one of the possibilities for the messages to not pass through is proper error handling in between the omitted code. 由于您已经省略了“ for循环”语句和第一个collector.emit语句之间的代码,因此消息无法通过的一种可能是在省略的代码之间进行适当的错误处理。 You can ensure putting try-catch block or debug by logging just before the "collector.emit" statement to check if your code is indeed reaching there. 您可以通过在“ collector.emit”语句之前进行日志记录来检查代码是否确实到达那里,从而确保放置try-catch块或调试。

The above can also be checked on the storm-ui where it will show the topology metrics of transmitting messages in between the spouts/bolts. 也可以在storm-ui上检查以上内容,其中将显示在喷嘴/螺栓之间传输消息的拓扑度量。 It also reports any errors messages that may have occurred in between task execution. 它还报告任务执行之间可能发生的任何错误消息。

The other possibility is in case you are using a multi-node cluster, if your tasks are spread out on the node, (ie, if you have assigned more than 1 worker in the topology config), ensure that the machines can communicate with each other over the network on the designated ports configured in storm.yaml files. 另一种可能性是,如果您使用的是多节点集群,并且您的任务分散在该节点上(例如,如果您在拓扑配置中分配了1个以上的工作线程),请确保计算机可以与每台计算机进行通信其他通过网络在storm.yaml文件中配置的指定端口上。

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

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