假设我们有以下拓扑
spout A -> bolt B -> bolt C -> bolt E
和 bolt E 是最后一个,它会在数据库中保留信息,因此无需发出任何元组。如何实施这样的解决方案,
如果我没有定义 output_fields - 那么我会得到异常
Exception in thread "main" java.io.IOException: org.apache.storm.thrift.protocol.TProtocolException: Required field 'output_fields' is unset! Struct:StreamInfo(output_fields:null, direct:false)
at storm.petrel.ThriftReader.read(ThriftReader.java:77)
at storm.petrel.GenericTopology.readTopology(GenericTopology.java:36)
at storm.petrel.GenericTopology.main(GenericTopology.java:53)
Caused by: org.apache.storm.thrift.protocol.TProtocolException: Required field 'output_fields' is unset! Struct:StreamInfo(output_fields:null, direct:false)
at org.apache.storm.generated.StreamInfo.validate(StreamInfo.java:407)
at org.apache.storm.generated.StreamInfo$StreamInfoStandardScheme.read(StreamInfo.java:485)
at org.apache.storm.generated.StreamInfo$StreamInfoStandardScheme.read(StreamInfo.java:441)
at org.apache.storm.generated.StreamInfo.read(StreamInfo.java:377)
at org.apache.storm.generated.ComponentCommon$ComponentCommonStandardScheme.read(ComponentCommon.java:681)
at org.apache.storm.generated.ComponentCommon$ComponentCommonStandardScheme.read(ComponentCommon.java:636)
at org.apache.storm.generated.ComponentCommon.read(ComponentCommon.java:552)
at org.apache.storm.generated.Bolt$BoltStandardScheme.read(Bolt.java:451)
at org.apache.storm.generated.Bolt$BoltStandardScheme.read(Bolt.java:427)
at org.apache.storm.generated.Bolt.read(Bolt.java:358)
at org.apache.storm.generated.StormTopology$StormTopologyStandardScheme.read(StormTopology.java:727)
at org.apache.storm.generated.StormTopology$StormTopologyStandardScheme.read(StormTopology.java:683)
at org.apache.storm.generated.StormTopology.read(StormTopology.java:595)
at storm.petrel.ThriftReader.read(ThriftReader.java:75)
... 2 more
答案 0 :(得分:0)
请重新检查螺栓E,确保它没有被任何其他螺栓设置(它的意思是螺栓E没有被任何方法使用TopologyBuilder.setBolt,例如:TopologyBuilder.setBolt(" mybolt& #34;,新的MyBolt())。fieldsGrouping(" bolt E", new Fields(new String [] {" user_id"}));