Hello,

I am currently creating an XML topology parser. Each bolt has its input
spout stored in a List, so I want to do something like the following:

...

TopologyParser parser = new TopologyParser();
parser.parseTopology("some-file.xml");
components = parser.getComponents();
Iterator<Component> itr = components.iterator();
builder = new TopologyBuilder();
while(itr.hasNext()) {
    Component comp = itr.next();
    if(comp.getType().equals("Bolt")) {
    BoltDeclarer declarer = builder.setBolt(comp.getName(), new
SampleBolt(comp.getName(), comp.getExecutors());
    if(comp.getUpstreamTasks() != null && comp.getUpstreamTasks().size() >
0) {
    for(String upstream_task : comp.getUpstreamTasks()) {
     declarer.directGrouping(upstream_task);
    }
    }
    }
}

Config conf = new Config();
conf.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());

...

So, in the above code the TopologyParser parser parses the topology from a
file and the components variable is a list of all the Component objects
(the TopologyParser and the Component classes
are custom built by me). If a component is for type "Bolt" and has upstream
tasks, they have their output registered as directly grouped to the bolt.
Unfortunately, the above approach does not seem to work.
Any suggestions on how to make something the above work?

Thank you,
Nikos

-- 
Nikolaos Romanos Katsipoulakis,
University of Pittsburgh, PhD candidate

Reply via email to