Package backtype.storm

Examples of backtype.storm.Config


    private static final String WORD_SPOUT = "WORD_SPOUT";
    private static final String LOOKUP_BOLT = "LOOKUP_BOLT";
    private static final String TOTAL_COUNT_BOLT = "TOTAL_COUNT_BOLT";

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

        Map<String, Object> hbConf = new HashMap<String, Object>();
        if(args.length > 0){
            hbConf.put("hbase.rootdir", args[0]);
        }
        config.put("hbase.conf", hbConf);

        WordSpout spout = new WordSpout();
        TotalWordCounter totalBolt = new TotalWordCounter();

        SimpleHBaseMapper mapper = new SimpleHBaseMapper().withRowKeyField("word");
View Full Code Here


        Pattern inPattern = Pattern.compile("x-.*");
        TailSpout spout = new TailSpout(spf, statusFile, tempDir, inPattern);
        spout.setReliableMode(true);

        // open spout
        Config conf = new Config();
        TopologyContext context = null;
        TestSpoutOutputCollector collector = new TestSpoutOutputCollector();
        spout.open(conf, context, collector);
       
        // add some files
View Full Code Here

    // Add HBaseBolt
    builder.setBolt("hbase-counters", new HBaseCountersBolt(config), 1)
        .shuffleGrouping("spout");

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

    LocalCluster cluster = new LocalCluster();
    cluster
        .submitTopology("hbase-example", stormConf, builder.createTopology());
View Full Code Here

    builder.setBolt("hbase-counters", new HBaseCountersBatchBolt(ttConfig), 2)
        .fieldsGrouping("spout", new Fields("shortid"));

    LocalCluster cluster = new LocalCluster();

    Config stormConfig = new Config();
    stormConfig.setDebug(true);
    stormConfig.setMaxSpoutPending(3);

    cluster.submitTopology("hbase-example", stormConfig,
        builder.buildTopology());

    Thread.sleep(10000);
View Full Code Here

        .each(new Fields("shortid", "date"), new DatePartitionFunction(),
            new Fields("cf", "cq")).project(new Fields("shortid", "cf", "cq"))
        .groupBy(new Fields("shortid", "cf", "cq"))
        .persistentAggregate(state, new Count(), new Fields("count"));

    Config conf = new Config();
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("hbase-trident-aggregate", conf, topology.build());

    Utils.sleep(5000);
    cluster.shutdown();
View Full Code Here

    config.addColumn("data", "date");

    // Add HBaseBolt
    builder.setBolt("hbase", new HBaseBolt(config), 1).shuffleGrouping("spout");

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

    LocalCluster cluster = new LocalCluster();
    cluster
        .submitTopology("hbase-example", stormConf, builder.createTopology());
View Full Code Here

    TridentTopology topology = new TridentTopology();
    topology.newStream("shorturls", spout).partitionPersist(
        new HBaseValueFactory(updateConfig),
        new Fields("shortid", "url", "user", "date"), new HBaseValueUpdater());

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

    cluster.submitTopology("hbase-trident-updater", conf, topology.build());
    Utils.sleep(10000);
    cluster.shutdown();
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<2; i++) {
                LOG.info("DRPC RESULT: " + drpc.execute("words", "dog the dog cat"));
                Thread.sleep(1000);
            }
            System.exit(0);
        } else {
            conf.setNumWorkers(3);
            StormSubmitter.submitTopology(args[0], conf, buildTopology(null));
        }
    }
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<2; i++) {
                _spout.feed(new ArrayList(Arrays.asList("dog the the cat")));
                Thread.sleep(10000);
                LOG.info("DRPC RESULT: " + drpc.execute("words", "dog the dog cat"));
            }
            System.exit(0);
        } else {
            conf.setNumWorkers(3);
            StormSubmitter.submitTopology(args[0], conf, buildTopology(null));
        }
    }
View Full Code Here

    if (!MyUtilities.checkSendMode(map))
      throw new RuntimeException("BATCH_SEND_MODE value is not recognized.");
  }

  public Main(QueryPlan queryPlan, Map map, String confPath) {
    final Config conf = SystemParameters.mapToStormConfig(map);

    addVariablesToMap(conf, confPath);
    putBatchSizes(queryPlan, conf);
    final TopologyBuilder builder = createTopology(queryPlan, conf);
    StormWrapper.submitTopology(conf, builder);
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.