![](/img/trans.png)
[英]Apache Storm (Java): Bolt not receiving tuple from other 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.