
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;

/**
 * This topology counts the words from sentences emmited from a random sentence spout.
 */
public class TopWordFinderTopologyPartA {

  public static void main(String[] args) throws Exception {

    TopologyBuilder builder = new TopologyBuilder();

    Config config = new Config();
    config.setDebug(true);


    /*
    ----------------------TODO-----------------------
    Task: wire up the topology

    NOTE:make sure when connecting components together, using the functions setBolt(name,…) and setSpout(name,…),
    you use the following names for each component:

    RandomSentanceSpout -> "spout"
    SplitSentenceBolt -> "split"
    WordCountBolt -> "count"


    ------------------------------------------------- */


    config.setMaxTaskParallelism(3);

    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("word-count", config, builder.createTopology());

    //wait for 60 seconds and then kill the topology
    Thread.sleep(60 * 1000);

    cluster.shutdown();
  }
}

@@ -1,29 +1,28 @@
-%0A
 import backtype.storm.Config
@@ -85,334 +85,32 @@
 orm.
-StormSubmitter;%0Aimport backtype.storm.topology.BasicOutputCollector;%0Aimport backtype.storm.topology.OutputFieldsDeclarer;%0Aimport backtype.storm.topology.TopologyBuilder;%0Aimport backtype.storm.topology.base.BaseBasicBolt;%0Aimport backtype.storm.tuple.Fields;%0Aimport backtype.storm.tuple.Tuple;%0Aimport backtype.storm.tuple.Values
+topology.TopologyBuilder
 ;%0A%0A/
@@ -248,16 +248,18 @@
 tA %7B%0A%0A  
+ 
+ 
 public s
@@ -305,24 +305,28 @@
 xception %7B%0A%0A
+    
     Topology
@@ -371,16 +371,20 @@
 );%0A%0A    
+  
+  
 Config c
@@ -401,24 +401,28 @@
 w Config();%0A
+    
     config.s
@@ -437,17 +437,16 @@
 true);%0A%0A
-%0A
     /*%0A 
@@ -853,18 +853,197 @@
 ---- */%0A
-%0A%0A
+        builder.setSpout(%22spout%22, new RandomSentenceSpout());%0A        builder.setBolt(%22split%22, new SplitSentenceBolt());%0A        builder.setBolt(%22count%22, new WordCountBolt());%0A%0A    
     conf
@@ -1068,24 +1068,28 @@
 lelism(3);%0A%0A
+    
     LocalClu
@@ -1123,24 +1123,28 @@
 ster();%0A    
+  
+  
 cluster.subm
@@ -1200,24 +1200,28 @@
 pology());%0A%0A
+    
     //wait f
@@ -1265,16 +1265,20 @@
 ogy%0A    
+  
+  
 Thread.s
@@ -1291,24 +1291,28 @@
 0 * 1000);%0A%0A
+    
     cluster.
@@ -1323,14 +1323,16 @@
 down();%0A
+  
   %7D%0A%7D%0A

add topology