Java Code Examples for storm.starter.bolt.PrinterBolt

The following are top voted examples for showing how to use storm.starter.bolt.PrinterBolt. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: big-data-system   File: CopyOfPrintSampleStream.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
    String consumerKey = args[0]; 
    String consumerSecret = args[1]; 
    String accessToken = args[2]; 
    String accessTokenSecret = args[3];
    String[] arguments = args.clone();
    String[] keyWords = Arrays.copyOfRange(arguments, 4, arguments.length);
    
    TopologyBuilder builder = new TopologyBuilder();
    
    builder.setSpout("twitter", new TwitterSampleSpout(consumerKey, consumerSecret,
                            accessToken, accessTokenSecret, keyWords));
    builder.setBolt("print", new PrinterBolt())
            .shuffleGrouping("twitter");
            
            
    Config conf = new Config();
    
    
    LocalCluster cluster = new LocalCluster();
    
    cluster.submitTopology("test", conf, builder.createTopology());
    
    Utils.sleep(10000);
    cluster.shutdown();
}
 
Example 2
Project: cdh-storm   File: PrintSampleStream.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
    String consumerKey = args[0]; 
    String consumerSecret = args[1]; 
    String accessToken = args[2]; 
    String accessTokenSecret = args[3];
    String[] arguments = args.clone();
    String[] keyWords = Arrays.copyOfRange(arguments, 4, arguments.length);
    
    TopologyBuilder builder = new TopologyBuilder();
    
    builder.setSpout("spoutId", new TwitterSampleSpout(consumerKey, consumerSecret,
                            accessToken, accessTokenSecret, keyWords));
    builder.setBolt("print", new PrinterBolt())
            .shuffleGrouping("spout");
            
            
    Config conf = new Config();
    
    
    LocalCluster cluster = new LocalCluster();
    
    cluster.submitTopology("test", conf, builder.createTopology());
    
    Utils.sleep(10000);
    cluster.shutdown();
}
 
Example 3
Project: storm-query-operators   File: SingleJoinExample.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
  FeederSpout genderSpout = new FeederSpout(new Fields("id", "gender"));
  FeederSpout ageSpout = new FeederSpout(new Fields("id", "age"));

  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("gender", genderSpout);
  builder.setSpout("age", ageSpout);
  builder.setBolt("join", new SimpleJoinBolt(new Fields("gender", "age"))).fieldsGrouping("gender", new Fields("id"))
      .fieldsGrouping("age", new Fields("id"));
  builder.setBolt("printer", new PrinterBolt()).shuffleGrouping("join");

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

  LocalCluster cluster = new LocalCluster();
  cluster.submitTopology("join-example", conf, builder.createTopology());

  for (int i = 0; i < 10; i++) {
    String gender;
    if (i % 2 == 0) {
      gender = "male";
    }
    else {
      gender = "female";
    }
    genderSpout.feed(new Values(i, gender));
  }

  for (int i = 9; i >= 0; i--) {
    ageSpout.feed(new Values(i, i + 20));
  }

  Utils.sleep(2000);
  cluster.shutdown();
}
 
Example 4
Project: sentweet   File: PrintSampleStream.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("twitter_spout", new TwitterSampleSpout());
    builder.setBolt("print_bolt", new PrinterBolt()).shuffleGrouping("twitter_spout");
    Config conf = new Config();
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("sentweet", conf, builder.createTopology());
    Utils.sleep(10000);
    cluster.shutdown();
}
 
Example 5
Project: CadalWorkspace   File: PrintSampleStream.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) {
    String username = args[0];
    String pwd = args[1];
    TopologyBuilder builder = new TopologyBuilder();
    
    builder.setSpout("spout", new TwitterSampleSpout(username, pwd));
    builder.setBolt("print", new PrinterBolt())
            .shuffleGrouping("spout");
            
    
    Config conf = new Config();
    
    
    LocalCluster cluster = new LocalCluster();
    
    cluster.submitTopology("test", conf, builder.createTopology());
    
    Utils.sleep(10000);
    cluster.shutdown();
}