Package backtype.storm

Examples of backtype.storm.LocalCluster


            conf.setNumWorkers(3);
           
            StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
        } else {
       
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("test", conf, builder.createTopology());
            Utils.sleep(10000);
            cluster.killTopology("test");
            cluster.shutdown();   
        }
    }
View Full Code Here


        Config conf = new Config();
       
        if(args==null || args.length==0) {
            conf.setMaxTaskParallelism(3);
            LocalDRPC drpc = new LocalDRPC();
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
           
            String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
            for(String url: urlsToTry) {
                System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
            }
           
            cluster.shutdown();
            drpc.shutdown();
        } else {
            conf.setNumWorkers(6);
            StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
        }
View Full Code Here

       
        Config conf = new Config();
       
        if(args==null || args.length==0) {
            LocalDRPC drpc = new LocalDRPC();
            LocalCluster cluster = new LocalCluster();
           
            cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));

            for(String word: new String[] {"hello", "goodbye"}) {
                System.out.println("Result for \"" + word + "\": "
                        + drpc.execute("exclamation", word));
            }
           
            cluster.shutdown();
            drpc.shutdown();
        } else {
            conf.setNumWorkers(3);
            StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
        }
View Full Code Here

    public static void main(String[] args) throws Exception {
        Config conf = new Config();
        conf.setMaxSpoutPending(20);
        if(args.length==0) {
            LocalDRPC drpc = new LocalDRPC();
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("wordCounter", conf, buildTopology(drpc));
            for(int i=0; i<100; i++) {
                System.out.println("DRPC RESULT: " + drpc.execute("words", "cat the dog jumped"));
                Thread.sleep(1000);
            }
        } else {
View Full Code Here

                .noneGrouping("count");
        builder.setBolt("buckets", new BucketCountUpdater(), 5)
                .fieldsGrouping("bucketize", new Fields("bucket"));
       
       
        LocalCluster cluster = new LocalCluster();
       
        Config config = new Config();
        config.setDebug(true);
        config.setMaxSpoutPending(3);
       
        cluster.submitTopology("top-n-topology", config, builder.buildTopology());
       
        Thread.sleep(3000);
        cluster.shutdown();
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        LocalDRPC drpc = new LocalDRPC();

        Config conf = new Config();
        LocalCluster cluster = new LocalCluster();

        cluster.submitTopology("reach", conf, buildTopology(drpc));

        Thread.sleep(2000);

        System.out.println("REACH: " + drpc.execute("reach", "aaa"));
        System.out.println("REACH: " + drpc.execute("reach", "foo.com/blog/1"));
        System.out.println("REACH: " + drpc.execute("reach", "engineering.twitter.com/blog/5"));


        cluster.shutdown();
        drpc.shutdown();
    }
View Full Code Here

           
            StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
        } else {       
            conf.setMaxTaskParallelism(3);

            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("word-count", conf, builder.createTopology());
       
            Thread.sleep(10000);

            cluster.shutdown();
        }
    }
View Full Code Here

        builder.setBolt("exclaim", new ExclamationBolt(), 3)
                .shuffleGrouping("drpc");
        builder.setBolt("return", new ReturnResults(), 3)
                .shuffleGrouping("exclaim");
       
        LocalCluster cluster = new LocalCluster();
        Config conf = new Config();
        cluster.submitTopology("exclaim", conf, builder.createTopology());
       
        System.out.println(drpc.execute("exclamation", "aaa"));
        System.out.println(drpc.execute("exclamation", "bbb"));
       
    }
View Full Code Here

        builder.setBolt("partial-count", new BatchCount(), 5)
                .noneGrouping("spout");
        builder.setBolt("sum", new UpdateGlobalCount())
                .globalGrouping("partial-count");
       
        LocalCluster cluster = new LocalCluster();
       
        Config config = new Config();
        config.setDebug(true);
        config.setMaxSpoutPending(3);
       
        cluster.submitTopology("global-count-topology", config, builder.buildTopology());
       
        Thread.sleep(3000);
        cluster.shutdown();
    }
View Full Code Here

    private StormRunner() {
    }

    public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds)
            throws InterruptedException {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(topologyName, conf, topology);
        Thread.sleep((long) runtimeInSeconds * MILLIS_IN_SEC);
        cluster.killTopology(topologyName);
        cluster.shutdown();
    }
View Full Code Here

TOP

Related Classes of backtype.storm.LocalCluster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.