A rough overview since I don't know if I can share code 1) create a thrift connection 2) get a Nimbus.Client object (I will call this 'client') 3) call client.getTopology(<topology id>) - returns StormTopology, I will call this 'topology' 4) Iterate Map<String, SpoutSpec> that is returned by topology.get_spouts(), ignore any whose key starts with "__" as these are system spouts 5) Iterate Map<String, Bolt> that is returned by topology.get_bolts(), ignore any whose key starts with "__" 6) for each Bolt, do bolt.get_common().get_inputs().keySet() which returns Set<GlobalStreamId> 8) for each 'input' in Set<GlobalStreamId>, call input.get_componentId(). Flag the component (spout or bolt) that is writing to this bolt. 9) At the end, you know that any bolt that is writing to another bolt has been flagged and is not a leaf bolt.
On Tue, Jun 17, 2014 at 6:31 PM, Babar Ismail <[email protected]> wrote: > Is there a way to figure out which bolt is at the end of the chain using > the thrift api? > > > > For instance, I have this topology: > > TopologyBuilder builder = *new* TopologyBuilder(); > > builder.setSpout("Hello", *new* HelloWorldSpout(), 1); > > builder.setBolt("World", *new* HelloWorldBolt(), 1).shuffleGrouping( > "Hello"); > > builder.setBolt("World2", *new* HelloWorldBolt(), 1).shuffleGrouping( > "World"); > > > > Is there a way to know that world2 is at the end of the chain? >
