Package backtype.storm

Examples of backtype.storm.Config


          // Query scaled stream statistics
          .stateQuery(scaledStreamStatistics, new Fields("featureIndex", "queryType"), new StreamFeatureStatisticsQuery("scaledStreamStats"), new Fields("stats"))
          .project(new Fields("stats"));

      cluster.submitTopology("testStandardScaler", new Config(), toppology.build());

      Thread.sleep(8000);

      double mean0 = extractDouble(localDRPC.execute("queryStats", "[[0, \"MEAN\"]]"));
      double mean1 = extractDouble(localDRPC.execute("queryStats", "[[1, \"MEAN\"]]"));
View Full Code Here


      // convert DRPC args to instance
          .each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance"))

          // Query classifier to classify instance
          .stateQuery(perceptronModel, new Fields("instance"), new ClassifyQuery<Boolean>("perceptron"), new Fields("prediction")).project(new Fields("prediction"));
      cluster.submitTopology(this.getClass().getSimpleName(), new Config(), toppology.build());

      Thread.sleep(4000);

      assertEquals(Boolean.TRUE, extractPrediction(localDRPC.execute("predict", "1.0 0.0 0.0")));
      assertEquals(Boolean.TRUE, extractPrediction(localDRPC.execute("predict", "1.0 0.0 1.0")));
View Full Code Here

      //dump the stream data into rdbms table   
      RDBMSDumperBolt dumperBolt = new RDBMSDumperBolt(primaryKey, tableName, columnNames, columnTypes, rdbmsUrl, rdbmsUserName, rdbmsPassword);
      builder.setBolt("dumperBolt",dumperBolt, 1).shuffleGrouping("spout");

      Config conf = new Config();
      conf.setDebug(true);
      LocalCluster cluster = new LocalCluster();
      cluster.submitTopology("rdbms-workflow", conf, builder.createTopology());
      Utils.sleep(10000);
      cluster.shutdown();
    }
View Full Code Here

    @Override
    public void prepare(Map stormConf, TopologyContext context,
            OutputCollector collector) {

        _collector = collector;
        this.conf = new Config();
        this.conf.putAll(stormConf);

        int threadCount = ConfUtils.getInt(conf, "fetcher.threads.number", 10);

        checkConfiguration();
View Full Code Here

        return sourceComponent.equals(Constants.SYSTEM_COMPONENT_ID)
                && sourceStreamId.equals(Constants.SYSTEM_TICK_STREAM_ID);
    }

    public Map<String, Object> getComponentConfiguration() {
        Config conf = new Config();
        conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 5);
        return conf;
    }
View Full Code Here

        builder.setBolt("exclaim1", new ExclamationBolt(), 3)
                .shuffleGrouping("word");
        builder.setBolt("exclaim2", new ExclamationBolt(), 2)
                .shuffleGrouping("exclaim1");
               
        Config conf = new Config();
        conf.setDebug(true);
       
        if(args!=null && args.length > 0) {
            conf.setNumWorkers(3);
           
            StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
        } else {
       
            LocalCluster cluster = new LocalCluster();
View Full Code Here

   
    public static void main(String[] args) throws Exception {
        LinearDRPCTopologyBuilder builder = construct();
       
       
        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

        wireTopology();
    }

    private static Config createTopologyConfiguration() {
        Config conf = new Config();
        conf.setDebug(true);
        return conf;
    }
View Full Code Here

   
    public static void main(String[] args) throws Exception {
        LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
        builder.addBolt(new ExclaimBolt(), 3);
       
        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

                ;
        return topology.build();
    }
   
    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 {
            conf.setNumWorkers(3);
            StormSubmitter.submitTopology(args[0], conf, buildTopology(null));       
        }
    }
View Full Code Here

TOP

Related Classes of backtype.storm.Config

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.